展开全部
给你一2113个例子看看,你就知道5261怎么做4102了
C++的接口typedef struct
{
unsigned long DeviceType;
int Handle;
int NumberOfClients;
int SerialNumber;
int MaxAllowedClients;
}NeoDevice;
int _stdcall icsneoFindNeoDevices(unsigned long DeviceTypes, NeoDevice *pNeoDevices, int *pNumberOfDevices);
Python调用的代码1653:class NeoDevice(Structure):
_fields_ = [("DeviceType",c_ulong),
("Handle",c_int),
("NumberOfClients",c_int),
("SerialNumber",c_int),
("MaxAllowedClients",c_int)]
class cNeoVICan(CCanBase):
def __init__(self):
neoVi = windll.icsneo40
self.icsneoFindNeoDevices = neoVi.icsneoFindNeoDevices
if __name__ == "__main__":
canBus = cNeoVICan()
print canBus.icsneoGetDLLVersion()
iNumberOfDevices = (NeoDevice * 10)()
num = c_int()
iResult = canBus.icsneoFindNeoDevices(c_ulong(65535), cast(iNumberOfDevices, POINT(NeoDevice)), byref(num))