如何在Python 3.1中进行Windows API调用?

2024-01-03

有没有人找到一个版本pywin32 http://python.net/crew/mhammond/win32/对于Python 3.x?最新的版本似乎是 2.6。

或者,我如何在 Python 3.1 中“滚动我自己的”Windows API 调用?


你应该能够做所有的事情ctypes http://docs.python.org/library/ctypes.html,如果有点麻烦的话。

以下是获取“通用应用程序数据”文件夹的示例:

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)

Result:

C:\Documents and Settings\All Users\Application Data
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在Python 3.1中进行Windows API调用? 的相关文章

随机推荐