2014-07-09 37 views
1

这是Windows 64的Python 2.7AttributeError错误:函数 'GetWindowLongPtrW' 未找到

from ctypes import * 
user32 = windll.user32 
GWL_STYLE = -16 
style = c_long(0) 
pstyle = pointer(style) 
pstyle = user32.GetWindowLongPtrW(hwnd, GWL_STYLE) 

我得到的标题错误。 ctypes不支持这个功能吗?我在这个pyscript中使用其他的user32函数没有问题。

回答

1

您需要在32位进程中使用GetWindowLongW,在64位进程中使用GetWindowLongPtrW

+0

是的,我在64位窗口,使用GetWindowLongPtr,并获取该错误。 – user3574253

0

解决了我的问题。我在64位Windows 7上安装了32位版本的Python。上面的代码在安装Python 2.7.8 x64后工作。