[python-win32] Help needed : FindWindowEx

Simon Dahlbacka simon.dahlbacka at gmail.com
Thu May 3 07:24:57 CEST 2007


Random thought.. there *has* to be a better way of finding out when a usb
device is plugged in...

(not that I know how, but I haven't needed to find out either..)

On 5/3/07, Amit Arora <Amit.Arora at infogain.com> wrote:
>
>
>
> This helps a lot,  there was actually a confusion in window names as you
> mentioned . I tried this now for notepad while opening notepad on
> desktop , it worked :)
>
> Import win32gui
> hWnd = win32ui.FindWindowEx(win32gui.GetDesktopWindow(),
> None,"Notepad",None)
>
> Value of hWnd I get :
> object 'PyCWnd' - assoc is 00B4E620, vi=<None>, notify=0,ch/u=0/0, mh=0,
> kh=0
>
> Should this be applicable to locate popups on desktop (may be during an
> application installation, as we get like - while connecting a new
> hardware on USB - "New Hardware found" ) , guess there's an API
> AnyPopup() for this,  any imputs on this will be of great help too .....
>
> Regards,
> ~Amit Arora
>
>
> -----Original Message-----
> From: python-win32-bounces at python.org
> [mailto:python-win32-bounces at python.org] On Behalf Of Roger Upole
> Sent: Thursday, May 03, 2007 9:56 AM
> To: python-win32 at python.org
> Subject: [python-win32] Re: Help needed : FindWindowEx
>
> > Amit Arora wrote:
> > Hi,
> >
> > I am a Amateur in python and an doing some work on Python and Win32
> APIs.
> >
> > One of my task includes finding the active window , during any
> > installation proces and proceed ......
> > Take an instance : I connect a USB device say a USB printer to the USB
>
> > port , as soon as it connects we get a pop-up saying "New Hardware
> Found"
> >
> > I need to detect that popup , and then proceed with the other
> > installation steps if that popup occurs :
> >
> > Trying to check its appearance with the following command :
> >
> > #!/usr/local/bin/python
> > Import os , win32gui, win32ui
> >
> > hWnd = win32ui.FindWindowEx(win32gui.GetDesktopWindow(), None,
> > "wndclass_desked_gsk",None)
> >
> > Getting the following message :
> > Traceback (most recent call last):
> >   File "<interactive input>", line 1, in <module>
> > win32ui: No window can be found.
>
> A couple things to check:
> Are you sure the window class name is correct ?
> Is the desktop window actually its parent ?
>
>    hth
>        Roger
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20070503/1fceac76/attachment.html 


More information about the Python-win32 mailing list