Re: simulating mouse clicks in Delphi
Posted by webmaster Guido on August 12, 2003 at 15:17:04:
In Reply to: simulating mouse clicks.. posted by Turek on August 11, 2003 at 12:45:23:
: SetCursorPos(x, y);
: this one will click on active window, but i need to do something like
With the following sequence, you simulate a mouse click at the location 100 pixels from the left of the screen and 200 pixels from the top of the screen:
Contrary to what you wrote, this is not limited to the "active" window, but you can simulate a mouse click on any position of the screen, be it a button, menu, shortcut, or whatever in any *visible* window of any application or even on the desktop. In short, if you simulate a mouseclick in this way, it is exactly the same as if you would move and click the mouse manually.
Note: in SetCursorPos(X, Y) the coordinates are relative to the screen, not relative to the client area of your Delphi-form.
[ DelphiLand: free Delphi source code, tips, tutorials ]