winapi: mouseclick

Tim Golden tim.golden at viacom-outdoor.co.uk
Tue Jan 27 09:53:17 CET 2004


>-----Original Message-----
>From: KNS [mailto:netquest at sympatico.ca]
>Sent: 27 January 2004 08:19
>To: python-list at python.org
>Subject: Re: winapi: mouseclick
>
>
>
>Just to add some clarification, this is in fact a Python question.
>I'm just working within the Windows environment.  And, now that
>I'm here, I'm certain this is child's play for many of you, so
>a bit of help would be most welcomed.
>
>Thanks.
>
>KNS wrote:
>> 
>> Hello,
>> 
>> Can someone please suggest how to test for a mouse click using
>> the WinAPI?  I have dispatched a windows application and would
>> like to detect any mouseclicks (and keyboard entry for that 
>matter)...
>> 
>> Thanks.
>> 
>

<sigh>
Your question is not the most precise one I've ever seen. If
you have written a Windows app then you presumably understand
how the Windows messaging setup works. In which case, what
you need to do is to handle WM_LBUTTONDOWN and related messages. 

If you're not sure which messages to go for, look at this:

http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/use
rinput.asp

which gives an overview.

There's an example of doing this kind of thing in Python
using the ctypes modules:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/208699

You can also do it with the win32all extensions from Mark
Hammonds pages:

http://starship.python.net/crew/mhammond/win32/Downloads.html

If this isn't really what you were asking, could you post a
segment of code showing what you're about and where you're
stuck?

TJG


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________




More information about the Python-list mailing list