代码之家  ›  专栏  ›  技术社区  ›  Blorgbeard

如何在Python3.1中调用WindowsAPI?

  •  5
  • Blorgbeard  · 技术社区  · 15 年前

    有人找到版本的吗 pywin32 对于python 3.x?最新的版本是2.6版。

    或者,我如何在Python3.1中“滚动自己的”WindowsAPI调用?

    2 回复  |  直到 15 年前
        1
  •  5
  •   Lennart Regebro    15 年前

    Pywin32可用于3.0。python 3.1是两天前发布的,所以如果需要pywin32,您需要稍等,或者从源代码编译它们。

    http://sourceforge.net/project/showfiles.php?group_id=78018&package_id=79063

        2
  •  8
  •   Ryan Ginstrom    15 年前

    你应该能做一切 ctypes 如果有点麻烦的话。

    下面是获取“公共应用程序数据”文件夹的示例:

    from ctypes import windll, wintypes
    
    _SHGetFolderPath = windll.shell32.SHGetFolderPathW
    path_buf = wintypes.create_unicode_buffer(255)
    csidl = 35
    _SHGetFolderPath(0, csidl, 0, 0, path_buf)
    print(path_buf.value)
    

    结果:

    C:\Documents and Settings\All Users\Application Data