Send mouse message
-
I'm trying to send mouse message to a application programmatically . I use win32 API SendMessage() to MS Paint (just 4 a test) to draw : SendMessage(hwnd_paint,WM_LBUTTONDOWN,0,position). There was no error but nothing happened. Is there something wrong ?
-
I'm trying to send mouse message to a application programmatically . I use win32 API SendMessage() to MS Paint (just 4 a test) to draw : SendMessage(hwnd_paint,WM_LBUTTONDOWN,0,position). There was no error but nothing happened. Is there something wrong ?
1. Manually do the mouse event and using spy++ try to find out the appropriate values of
LPARAM
andWPARAM
2. After a lbuttondown message, also post a lbutton up message. Regards, Rajesh R. Subramanian You have an apple and me too. We exchange those and We have an apple each. You have an idea and me too. We exchange those and We have two ideas each. -
I'm trying to send mouse message to a application programmatically . I use win32 API SendMessage() to MS Paint (just 4 a test) to draw : SendMessage(hwnd_paint,WM_LBUTTONDOWN,0,position). There was no error but nothing happened. Is there something wrong ?
To fake input you should use the
SendInput
function. See here for details (talks about keyboard input but a lot of what is mentioned still applies). Steve -
I'm trying to send mouse message to a application programmatically . I use win32 API SendMessage() to MS Paint (just 4 a test) to draw : SendMessage(hwnd_paint,WM_LBUTTONDOWN,0,position). There was no error but nothing happened. Is there something wrong ?
Check out the
position
. Maybe it's not on the drawing canvas.Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
-
Check out the
position
. Maybe it's not on the drawing canvas.Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
-
I used Spy++ to get parameter, and try to SendMessage. But it dosent work. I cant understand what happened ????
Try replacing
WM_LBUTTONDOWN
withWM_MOUSEMOVE
. And I think you should pass something forWPARAM
, just passMK_LBUTTON
. This means left mouse button is down and we are dragging the mouse. Equivalent to drawing in MS-Paint.Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
-
I'm trying to send mouse message to a application programmatically . I use win32 API SendMessage() to MS Paint (just 4 a test) to draw : SendMessage(hwnd_paint,WM_LBUTTONDOWN,0,position). There was no error but nothing happened. Is there something wrong ?
Using
SendMessage
orPostMessage
message may or may not work, it depends on the program. As I mentioned theSendInput
API is specifically designed for faking input. Here are some reasons theSendMessage
/PostMessage
technique may not work: - The program calls theGetMessagePos
to get the coordinated of the mouse when a message was posted. - The program calls theGetAsyncKeyState
to check for mouse buttons. In short, theSendMessage
/PostMessage
may work, but then again it may not: it depends on how the program performs its input. Steve