[python-win32] EnumChildWindows
Radu Ciora
raduciora at yahoo.com
Mon Aug 20 23:39:38 CEST 2007
thanks for the reply Tim but that's how I got the sample from internet.
Anyway I changed the code like this:
...
win32gui.EnumChildWindows(l_hwnd, self.windowEnumerationHandler(l_hwnd,l_childlist), l_childlist)
...
def windowEnumerationHandler(self, hwnd, resultList):
...
but now I get the following error:
Traceback (most recent call last):
File "c:\Python24\Lib\site-packages\pyHook\HookManager.py", line 325, in MouseSwitch
return func(event)
File "D:\DAProject\Workspace\context\inputhook\RDFIO.py", line 111, in onMouseEvent
self.whatAmIDoin(event)
File "D:\DAProject\Workspace\context\inputhook\RDFIO.py", line 119, in whatAmIDoin
l_appName = self.getCurrentApplication()
File "D:\DAProject\Workspace\context\inputhook\RDFIO.py", line 57, in getCurrentApplication
self.wordInfo()
File "D:\DAProject\Workspace\context\inputhook\RDFIO.py", line 70, in wordInfo
self.getActiveWindowHandle()
File "D:\DAProject\Workspace\context\inputhook\RDFIO.py", line 93, in getActiveWindowHandle
win32gui.EnumChildWindows(l_hwnd, self.windowEnumerationHandler(l_hwnd,l_childlist), l_childlist)
TypeError: First param must be a callable object
Any ideas?
Thanks a million!
Radu.
----- Original Message ----
From: Tim Roberts <timr at probo.com>
To: Python-Win32 List <python-win32 at python.org>
Sent: Monday, 20 August, 2007 10:24:21 PM
Subject: Re: [python-win32] EnumChildWindows
Radu Ciora wrote:
> Hi everyone,
> can anyone give me an example of use of win32gui.EnumChildWindows()
> function
> as I can't seem to make it work:
>
> my code looks like this:
> ...
> win32gui.EnumChildWindows(l_hwnd, self.windowEnumerationHandler(),
> l_childlist)
That can't be your code. That calls windowEnumerationHandler, rather
than passing the address of it.
> ...
> def windowEnumerationHandler(hwnd, resultList):
Remember that a member function always gets a "self" parameter first.
All you need to do is change those two lines to:
win32gui.EnumChildWindows( l_hwnd, self.windowEnumerationHandler,
l_childlist )
...
def windowEnumerationHandler( self, hwnd, resultList ):
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20070820/81c16ce1/attachment.htm
More information about the python-win32
mailing list