111,098
社区成员




typedef struct
{
char cSerial[8];
char userNo[7];
char userName[33];
char unitNo[13];
char unitName[33];
}Y_INFO;
unsigned char WriteInfo(Y_INFO *info,unsigned short int *iRet)
public struct Y_INFO
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string cSerial;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)]
public string userNo;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)]
public string userName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 13)]
public string unitNo;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)]
public string unitName;
}
[DllImport("EDV.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl, EntryPoint = "WriteZFYInfo")]
public static extern bool WriteZFYInfo(ZFY_INFOX info, string sPwd, ref int iRet);
Y_INFO wIn;
wIn.cSerial = "W00000";
wIn.userNo = "123456";
wIn.userName = "";
wIn.unitNo = "";
wIn.unitName = "";
var winfo = WriteZFYInfo(wIn, pwd, ref iRet);
public struct Y_INFO {
/// char[8]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=8)]
public string cSerial;
/// char[7]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=7)]
public string userNo;
/// char[33]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=33)]
public string userName;
/// char[13]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=13)]
public string unitNo;
/// char[33]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=33)]
public string unitName;
}
[System.Runtime.InteropServices.DllImport("EDV.dll", EntryPoint="WriteInfo")]
public static extern byte WriteInfo(ref Y_INFO info, ushort param1, ref int iRet) ;