07-13-2006 09:11 AM
07-13-2006 09:26 AM - edited 07-13-2006 09:26 AM
Hello Jacky,
it is possible to change the position of the mouse cursor. Do to so, use the SetCursorPos function. This is a windows function, so you will have to include windows.h on top of your file. You will find more information here. Unfortunately I do not know any functions that simulate a mouse click, so I would simulate this by making the control active, using SetActiveCtrl, and then using FakeKeyStroke to simulate the enter key. On buttons this will have the same effect as clicking your mouse.
I hope this helps you a little bit further.
Wim
Message Edited by Wim S on 07-13-2006 04:27 PM
07-13-2006 06:00 PM
Then comes another question when trying to use "SetActiveCtrl(PanelHandle, ControlID)". Since that is an EXE file and we don't know its source codes, how can I get the panelhandle and control IDs?
Thanks!
Jacky
07-14-2006 01:43 AM
Jacky,
one possible way to do what you want, supposing the left clicks are on controls that accept hotkeys, is to send the appropriate (simulated) keystrokes to the application via windows messages. You will find useful this discussion that covers this subject.
07-14-2006 02:11 AM
07-14-2006 02:20 AM - edited 07-14-2006 02:20 AM
Another possibility is SendInput SDK function, that can actually send mouse event messages to a running application. Thake a look at my post in this discussion: the code is to send keystrokes but SendInput function actually can send mouse events too. Please note also the warning at the end of my words: a particular #define is needed for SendInput to work that I cannot find defined on my machine.
According to this MSDN article, a value greater than 0x0400 is used for this #define on NT machines and over: since I'm working on a XP one I should have defined a value of 0x0501 or greater, so I should have no problems in using this command but that macro is not even defined on my system, so the question mark still remains.
Message Edited by Roberto Bozzolo on 07-14-2006 09:22 AM