原始碼:
==============================================================
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
感謝!!