Exact Requirement : 
Need to write a Python script that keeps on running and when a USB
device is plugged in , it detects the device and flashes a message on
the propt or logs it to a file 
do suggest your ideas on this ........

________________________________

From: Simon Dahlbacka [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 03, 2007 10:55 AM
To: Amit Arora
Cc: Roger Upole; python-win32@python.org
Subject: Re: [python-win32] Help needed : FindWindowEx


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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
        [mailto: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ] On Behalf Of Roger Upole
        Sent: Thursday, May 03, 2007 9:56 AM
        To: python-win32@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@python.org
        http://mail.python.org/mailman/listinfo/python-win32 
        _______________________________________________
        Python-win32 mailing list
        Python-win32@python.org
        http://mail.python.org/mailman/listinfo/python-win32 
        


_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to