winapi: mouseclick

Tim Golden tim.golden at
Tue Jan 27 09:53:17 CET 2004

>-----Original Message-----
>From: KNS [mailto:netquest at]
>Sent: 27 January 2004 08:19
>To: python-list at
>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.
>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 
>> Thanks.

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:

which gives an overview.

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

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

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


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:

More information about the Python-list mailing list