winapi: mouseclick

KNS netquest at sympatico.ca
Wed Jan 28 04:31:27 CET 2004



This snippet launches the application...It's not strictly
meant for IE.

w=DispatchEx("InternetExplorer.Application")
w.Navigate(startpage)

w.Left=225
w.Top=25
w.Width=900
w.Height=960
w.Resizable=0
w.Visible=1
handle=w.HWND

lasturl = w.LocationURL
cururl = w.LocationURL

while w.Visible:
	if cururl != lasturl:
		#bunch of stuff here to check ReadyState
	#would also like to see if mouse click/keypress here...


This is an attempt to explore simple possibilities first.  If such
a solution doesn't exist, then 'yes' the use of pyHook will have to
be considered or even mandated.  Not knowing before hand can't be avoided.



Tim Golden wrote:

> 
> 
> 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