|
-
Jun 15th, 2003, 10:19 AM
#1
Thread Starter
Frenzied Member
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;
}
Magiaus
If I helped give me some points.
-
Jun 15th, 2003, 11:02 AM
#2
Monday Morning Lunatic
Re: pointers..?
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 refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 15th, 2003, 11:04 AM
#3
Thread Starter
Frenzied Member
I should have thought of that....
thanks
Magiaus
If I helped give me some points.
-
Jun 15th, 2003, 04:03 PM
#4
And the last two lines are invalid too (now that lpPoint is gone) and should be removed.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jun 15th, 2003, 04:55 PM
#5
Thread Starter
Frenzied Member
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
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|