问题描述
C++:有这样一个结构:typedefstruct_Event{BYTECode;//eventcodeBYTEDotID;//controllercomponentIDWORDreserved;//reservedSYSTEMTIMETime;//eventtime_Event*pNext;//pointernextevent;}TEvent,*PEvent;函数:intNT_GetEvent(unsignedlongLineID,BYTECtrlID,BYTE*Bagid,BYTE*EventCount,TEvent*lpEvent);
我现在想在C#中调用这样的结构,我该怎么写啊,麻烦大家指教指教#¥,下面是我自己写的,但有问题,只能读到且只能读一条记录(如设备有1个事件,可以正常使用,但如果有2个或2个以上事件就读不出来)[StructLayout(LayoutKind.Sequential)]//[SerializableAttribute]//[ComVisibleAttribute(true)]unsafepublicstructPEvent{publicbyteCode;publicbyteDotID;publicushortreserved;publicTimeTime;publicIntPtrpNext;}函数:[DllImport("TC3XY.dll")]publicstaticexternintNT_GetEvent(ushortLineID,shortCtrlID,refshortBagid,refshortEventCount,refPEventlpEvent);//获取设备事件
时间: 2024-11-05 12:29:20