Traceback (most recent call last):
File "<pyshell#309>" , line 1, in <module>
get_handles('Py thon26')
File "C:\Python26\e_ _handle.py", line 19, in get_handles
ctypes.windll.u ser32.EnumWindo ws(ctypes.c_lon g(function),cty pes.byref(ctype s.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.u ser32.EnumWindo ws(ctypes.POINT ER(function),ct ypes.byref(ctyp es.c_char_p(arg )))
and got a different error of:
Traceback (most recent call last):
File "<pyshell#311>" , line 1, in <module>
get_handles('Py thon26')
File "C:\Python26\e_ _handle.py", line 17, in get_handles
ctypes.windll.u ser32.EnumWindo ws(ctypes.POINT ER(function),ct ypes.byref(ctyp es.c_char_p(arg )))
TypeError: must be a ctypes type
Any ideas?