Traceback (most recent call last):
File "<pyshell#309>", line 1, in <module>
get_handles('Python26')
File "C:\Python26\e__handle.py", line 19, in get_handles
ctypes.windll.user32.EnumWindows(ctypes.c_long(fun ction),ctypes.byref(ctypes.c_char_p(arg)))
WindowsError: exception: access violation writing 0x0064BCF6
From some searching online I think it's because I'm not able to properly pass the function's address pointer.
Expand|Select|Wrap|Line Numbers
- from e__handle import EnumWindowsProc, EnumChildWindowsProc
- import ctypes
- global listed
- global parents
- listed=[]
- arg=str(parent_search_text)+'|'+str(parent_case_sensitive)+'|'+str(document)+'|'+str(child_search_text)+'|'+str(child_case_sensitive)+'|'+str(get_children)+'|'+str(id(EnumChildWindowsProc))
- function=id(EnumWindowsProc)
- ctypes.windll.user32.EnumWindows(ctypes.c_long(function),ctypes.byref(ctypes.c_char_p(arg)))
- if document==True:
- return listed
- else:
- listed=[]
I changed the one line to
ctypes.windll.user32.EnumWindows(ctypes.POINTER(fu nction),ctypes.byref(ctypes.c_char_p(arg)))
and got a different error of:
Traceback (most recent call last):
File "<pyshell#311>", line 1, in <module>
get_handles('Python26')
File "C:\Python26\e__handle.py", line 17, in get_handles
ctypes.windll.user32.EnumWindows(ctypes.POINTER(fu nction),ctypes.byref(ctypes.c_char_p(arg)))
TypeError: must be a ctypes type
Any ideas?