狼狼 发表于 2017-5-2 12:18:58

C++中 LPCWSTR 对应的 Python ctypes 类型

  看一下 WinNT.h 中的定义:


typedef wchar_t WCHAR;
typedef __nullterminated CONST WCHAR *LPCWSTR, *PCWSTR;
  再看一下 Python ctypes 中的类型对应关系:

ctypes type   C type                                       Python type
c_wchar_p      wchar_t * (NUL terminated)   unicode or None
  所以 LPCWSTR 对应 ctypes 中的 c_wchar_p.


例如:

target_file = ctypes.c_wchar_p(u'C:\\Program Files\\Tencent\\QQ\\Bin\\QQ.exe')
 
页: [1]
查看完整版本: C++中 LPCWSTR 对应的 Python ctypes 类型