-
pointers..?
is there a better way for me to initialize retPoint in the code below? My original code did not have two point structs but it crashed do to a null refreance when it ran. Why?
Code:
void CursorPos(System::Drawing::Point *lpPoint){
POINT iPoint;
LPPOINT retPoint = &iPoint;
GetCursorPos(retPoint);
lpPoint->X=retPoint->x;
lpPoint->Y=retPoint->y;
}
-
Re: pointers..?
Quote:
Originally posted by Magiaus
is there a better way for me to initialize retPoint in the code below? My original code did not have two point structs but it crashed do to a null refreance when it ran. Why?
Code:
void CursorPos(System::Drawing::Point *lpPoint){
POINT iPoint;
GetCursorPos(&iPoint);
lpPoint->X = iPoint->x;
lpPoint->Y = iPoint->y;
}
See the changes. retPoint is only a pointer anyway, not a full struct, and you don't need it.
-
I should have thought of that....
thanks
-
And the last two lines are invalid too (now that lpPoint is gone) and should be removed.
-
I get what you mean bu the last two are still right because i am superclassing the GetCursorPos API for use in vb.net or C# and it passes the equiv type out I am going to chang it to a return though i think