winapi: mouseclick

Tim Golden tim.golden at viacom-outdoor.co.uk
Tue Jan 27 09:09:06 EST 2004


>From: KNS [mailto:netquest at sympatico.ca]
>
>
>Thank you for the response.  I am actually using win32all to launch an 
>application and am waiting for user actions or changes in state.  Once 
>the application is launched (e.g., IE) the program just 
>records changes 
>in URLs.  Now I would like the various states (e.g., time, mouse 
>position) saved whenever the mouse is clicked on the application (or
>even the desktop).  So, can I just use an 'if' (within a 
>while-loop) to 
>test whether WM_LBUTTONDOWN == 0 and if so what is the appropriate 
>syntax with win32all?
>
>Thanks.

Could you *please* post some code, or at least pseudo-code, to
show us what you're doing. What is sounds like to me, is that
you're doing this, say:

import win32api
win32api.ShellExecute (0, "open", "iexplore.exe", None, None, 1)

and then you want to know what the user's doing within that
application so that you can, eg, keep track of URLs accessed etc.

Am I close? 

If I am, this isn't easy. If it is, strictly, Internet Explorer that
you're trying to use, then it does have an Events mechanism (about
which I know nothing) which I believe can be accessed from Python.

If it is any application in general which you're trying to keep track
of, that's more difficult. Windows (and by that I mean any modern GUI
system) apps don't work like your old-fashioned batch / terminal 
apps. You don't "wait" for a user to press something; rather, you set
up an event loop and handle or ignore any event which comes in. Each
application does this on its own behalf. To do the same on behalf of
another application requires either subclassing (messy) or system
key / mouse hooks (cf
http://cvs.sourceforge.net/viewcvs.py/uncpythontools/pyHook/)
or some other arcane mechanism.

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