在Win7上使用Python 2.6和ctypes我试图在COM dll中调用函数但没有成功 这是我正在做的代码片段。
import ctypes
from ctypes import *
h_func = c_int(0);
h_c = c_int(0);
h_text = ctypes.create_string_buffer(32);
usbDll = ctypes.WinDLL ("c:\\temp\\PwrUSBDll.dll");
CheckStatusPowerUSB = usbDll.CheckStatusPowerUSB;
InitPowerUSB = usbDll.InitPowerUSB;
#
#===This is where it all goes down the tubes.
#
InitPowerUSB (byref(h_func), byref(h_text), byref(h_c));
#
# I keep getting a WindowsError: exception: access violation writing 0x00000000
#
print h_func.value;
print h_text.value;
print h_c.value;
InitPowerUSB接受两个参数来返回数据并返回返回码 谁能帮我这个。我在C#中工作没有问题。
答案 0 :(得分:1)