findwindow by its class name

Steve Holden steve at holdenweb.com
Fri Oct 21 12:29:18 EDT 2005


James Hu wrote:
> Hi,
> 
> For the simple code:
> 
> from wxPython.wx import *
>  
> class MyApp(wxApp):
>     def OnInit(self):
>         frame = wxFrame(NULL, -1, "Hello App")
>         frame.Show(true)
>         self.SetTopWindow(frame)
>         return true
>  
> app = MyApp(0)
> app.MainLoop()
> 
> Is there any way to know this windows' class name? I need to find it by
> win32gui.FindWindow(classname,None) and send msg from another
> application, but not using its title "Hello App".
> MyApp is not the classname, for it couldn't be found by
> FindWindow("MyApp",None).
> 
> Thanks a lot in advance!
> 
I'm not saying it can'ty be done (which is a pity for you, because 
that's usually a cue for someone to contradict me) but it's expecting 
quite a lot of win32gui. A wxPython application is not a windows handle, 
and I suspect you will find that the classname you seek isn't visible 
from inside (wx)Python.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list