110,538
社区成员
发帖
与我相关
我的任务
分享
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TBasicResponse
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] TranCode;
public int RetCode;
}
private void button1_Click(object sender, EventArgs e)
{
Console.WriteLine("TBasicResponse={0}", Marshal.SizeOf(typeof(TBasicResponse)));
Console.WriteLine("TtagINFORUN={0}", Marshal.SizeOf(typeof(TtagINFORUN)));
Console.WriteLine("TtagINFODebug={0}", Marshal.SizeOf(typeof(TtagINFODebug)));
Console.WriteLine("TQryGateWayInfoRet={0}", Marshal.SizeOf(typeof(TQryGateWayInfoRet)));
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TtagINFODebug
{
public uint FlowHead;
public uint FlowTail;
public uint CurrFlowNo;
public uint SNo;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TQryGateWayInfoRet
{
public TBasicResponse tbRes;
public TtagINFORUN tgRun;
public TtagINFODebug tgDebug;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TtagINFORUN
{
public int bLoginOK;
public int bGetFLowNoOK;
public int bDispInitOK;
public uint PrivateSign;
public byte CtlStatus;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] ErrInfo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] PosStatus;
public byte StatusBar485;
public byte CurrDineNo;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TBasicResponse
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] TranCode;
public int RetCode;
}
[DllImport("GateWayDll.dll", CharSet = CharSet.Ansi)]
public static extern int GetPosStatus(string ip, int port,
ref TQryGateWayInfoRet ps);
Delphi
TBasicResponse=7
TtagINFORUN=275
TtagINFODebug=16
TQryGateWayInfoRet=298
C#
TBasicResponse=8
TtagINFORUN=152
TtagINFODebug=16
TQryGateWayInfoRet=176