Software Development Network>> Visual C#>> How to DllImport this struct?
i think this depend on the function you will pass this structure to it any way
is this worked after you change it to CharSet.Ansi
try this
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]
struct SM_PARAM
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
string SCA;
string TPA;
char TP_PID;
char TP_DCS;
string TP_SCTS;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 161)]
string TP_UD;
char index;
}
note:the size of the last array is 161 is thic correct or it is atypo
How to DllImport this struct?
Stormin
Chintan Vyas
i think this depend on the function you will pass this structure to it any way
is this worked after you change it to CharSet.Ansi
MMMalik
try this
try this
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]
struct SM_PARAM
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
string SCA;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
string TPA;
char TP_PID;
char TP_DCS;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
string TP_SCTS;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 161)]
string TP_UD;
char index;
}
note:the size of the last array is 161 is thic correct or it is atypo
hazz