原始码:
==============================================================
from ctypes import*
class TParamStruct(Structure):
_fields_= [('CSFlag',c_int),
('Price',c_int),
('Limit',c_int),
('TigValue',c_int),
('ShutFlag',c_int),
('Limit',c_int),
('ShutTime1',c_int),
('ShutTime2',c_int),
('ShutTime3',c_int),
('Alarm',c_int),
('WorkFlag',c_int),
('TickMoney',c_int),
('ReMoney',c_int),
('MeterID',c_int),
('JDQ',c_int)]
class TCardDataStruct(Structure):
_fields_= [('CardKind',c_int),
('AreaCode',c_int),
('iParamStruct',POINTER(TParamStruct))]
CardDataStruct = TCardDataStruct()
dll = windll.LoadLibrary("xtdll_tw_mw.dll")
PortId = 0
result = dll.xtRead(PortId,byref(CardDataStruct))
print CardDataStruct.AreaCode
print CardDataStruct.iParamStruct.CSFlag
==============================================================
回应:
25381111
print CardDataStruct.iParamStruct.CSFlag
AttributeError: 'LP_TParamStruct' object has no attribute 'CSFlag'
==============================================================
第一条有读出来但是用POINTER指向CSFlag就不行了,有确认过DLL档内有这条参数
我是参考:http://blog.csdn.net/magictong/article/details/3075478
感谢!!