What class in MFC holds all the mouse functions if there is one????? I need to retrieve the mouse coordinates as soon as the left mouse button is pressed and set the mouse position to those same coordinates when the screen is refreshed. This is in an MFC app. Any suggestions????????
I think the mouse message returns the coordinates of the mouse in the lparam and wparam. Not sure exactly.
The second param specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.
afx_msg void OnLButtonDown(
Of course you can always call into the WinAPI directly. GetCursorPos is what you want.
There IS a method of some class in MFC too, but I can't remember it.
Here is an addition to the question.
The GetCursorPos and SetCursorPos works, but I need to get and set the cursor position in relation to the window, not the screen. What function or method do I need to go about getting the position in the window and not the screen??????
I am sorry.
I just realized that I should have posted this thread in the Windows Programming Forum. Forgive Me.
I'm too lazy to search for the new thread now (if there is one), use ScreenToClient and ClientToScreen to convert between screen and window coordinates.
My responce was the name of the method in CWnd.
That's just a message handler Gareth. Of course he can use it to keep a constantly updated mouse position, but why when windows does it too?
WM_LBUTTON or OnLButtonDown WM_LBUTTONUP msgs