Windows SetCursorPos() relative problem (RESOLVED)
Hello again. This time I come with a windows API problem.
What I am wanting to do is set the position of the cursor to the center of my client window.
Looking through the MSDN documentation the SetCursorPos() function is what I am looking for. The problem is that the position specified for the parameters are not relative to the client window but the entire screen. How would I go about getting the position of the upper corner of my client window so I could calculate the center of the client window from there?
Thanks!
[Edited by - Funkyjive on June 21, 2009 7:46:34 PM]
Just get your cursor position and run it through ScreenToClient
POINT mouse;
GetCursorPos(&mouse);
ScreenToClient(hWndMain,&mouse); //stores our on screen mouse coordinates
POINT mouse;
GetCursorPos(&mouse);
ScreenToClient(hWndMain,&mouse); //stores our on screen mouse coordinates
Im not sure I understand the logic there? I already can get the location of my mouse in the client window what I want to do is be able to SET it's position in client coordinates.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement