【问题标题】:AttributeError: function 'GetWindowLongPtrW' not foundAttributeError:未找到函数“GetWindowLongPtrW”
【发布时间】:2014-07-09 21:41:25
【问题描述】:

这是在 windows x64 for python 2.7 上

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 函数没有问题。

【问题讨论】:

    标签: python-2.7 ctypes


    【解决方案1】:

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

    【讨论】:

    • 是的,我在 64 位 Windows 上,使用 GetWindowLongPtr,并收到该错误。
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2022-08-24
      • 2021-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-15
      • 2017-05-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多