what module should be imported?
On 6/30/07, Alan Gauld <[EMAIL PROTECTED]> wrote:
"Lisa Barrott" <[EMAIL PROTECTED]> wrote
> I was wondering if there was any way to force a mouse click at a set
> location using python even when the another window is focussed.
> I'm using Windows XP
Yes, you can use the Win32 API.
You need to get the target window handle with
-------------
HWND FindWindow(
LPCTSTR lpClassName, // pointer to class name
LPCTSTR lpWindowName // pointer to window name
);
---------------
or
--------------------
BOOL EnumWindows(
WNDENUMPROC lpEnumFunc, // pointer to callback function
LPARAM lParam // application-defined value
);
----------------------
Then you can use PostMessage() to generate a mouse event.
BOOL PostMessage(
HWND hWnd, // handle of destination window
UINT Msg, // message to post
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
You can get the full docs on these functions on MSDN and the winall
package should provide access to them, or the ctypes module will
allow direct access for a bit more work.
There might be other more pythonic modules around that do the
heavy lifting for you, but these are not too hard to use.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor