|
-
Jul 17th, 2001, 11:18 AM
#1
Thread Starter
Hyperactive Member
mousepos
When I call this function when a button is pressed it freezes. Will this get the mouse coordinates like it is intended to do?
Code:
void getmousepos()
{
POINT p;
for(;;)
GetCursorPos(&p);
SendMessage(editbxX, WM_SETTEXT,0,(LPARAM) p.x);
SendMessage(editbxY, WM_SETTEXT,0,(LPARAM) p.y);
}
Matt 
-
Jul 17th, 2001, 11:52 AM
#2
Frenzied Member
What you are doing might work, but there is an easier way if you are catching the mouse events. The HI and LO of the lParam is the x and the y of the mouse. So for example:
PHP Code:
case WM_LBUTTONDOWN:
SendMessage(editbxX, WM_SETTEXT,0,LOWORD(lParam)); //X Pos
SendMessage(editbxX, WM_SETTEXT,0,HIWORD(lParam)); //Y Pos
break;
Last edited by Technocrat; Jul 17th, 2001 at 11:55 AM.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Jul 17th, 2001, 01:25 PM
#3
Thread Starter
Hyperactive Member
I can't seem to get anything to work.What would you do if you wanted to get the mouse position after it moves? What functions would you use? Thanks
Matt 
-
Jul 17th, 2001, 01:27 PM
#4
Frenzied Member
Can you give me a better example of what you want.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Jul 17th, 2001, 01:59 PM
#5
Thread Starter
Hyperactive Member
I wanted it so that when you move the mouse the coordinates are updated in the 2 editboxes. I got everything to work finally. I just used the WM_MOUSEMOVE to have it update them. Thanks anyway
Matt 
-
Jul 17th, 2001, 02:08 PM
#6
Monday Morning Lunatic
Incidentally the reason it froze with your first code is because you were in an infinite loop and it was blocking any more messages from arriving (DispatchMessage won't return until the event handler has).
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
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
|