How can I simulate a mouse move, and then clic from a C++ app ?
I have an external app, with a graphical area. I need to move the mouse
to a specific location within this window, then clic and enter some text.
The goal is to drive this external app from my own app.
I have the handle of the main window, but I am not able to move the
mouse with a program.
Does anyone know how to do this ? Which system call do I have to use ?
Thanks
Ben
--
Cheers
Bjarne Nielsen
"Benoît Touron" <b.to...@citb.bull.net> skrev i en meddelelse
news:e6tCq1YZ...@TK2MSFTNGP09.phx.gbl...
> I haven't tried it, but did you look at the SetCursorPos() function??
>
Thanks Bjarne.
It works ! But I am still not able to simulate a mouse clic
in a specific location ot the windows client area.
I tried the following:
HWND other=::FindWindow(NULL,"CHILD WINDOW");
::SetWindowPos(other,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_SHOWWINDOW);
SetCursorPos(10,10);
::SendMessage(other,WM_LBUTTONDOWN,MK_LBUTTON,0x0A0A);
::SendMessage(other,WM_LBUTTONUP,MK_LBUTTON,0x0A0A);
The window actually moves to the top left corner of the screen. This
should pop-up the system menu (because the mouse is at the right
location), but nothing happens.
Any other (good) idea ?
Thanks a lot anyway.
Ben
--
Cheers
Bjarne Nielsen
"Benoît Touron" <b.to...@citb.bull.net> skrev i en meddelelse
news:%23Vo$eBaZDH...@TK2MSFTNGP10.phx.gbl...