华为(smeidll.dll)短信接口中一个函数:
声明:
int WINAPI GetDeliverSMExEx(
ULONG* sm_ID, //返回:短讯ID
unsigned char* DestTON, //返回:目标地址号码类型
unsigned char* DestNPI, //返回:目标地址编码方案
char* DestAddr, //返回:目标地址
unsigned char* OrgTON, //返回:源地址号码类型
unsigned char* OrgNPI, //返回:源地址编码方案
char* OrgAddr, //返回:源地址
unsigned char* PRI, //返回:优先权
unsigned char* RP,
unsigned char* UDHI,
unsigned char* PID, //返回:协议类型
unsigned char* DCS, //返回:编码方案
char* TimeStamp, //返回:下发时间
unsigned long * UDLen,
char* UserData, //返回:用户数据
unsigned char* StatusReport //返回:状态报告标志,0表示不是状态报告,1:表示为状态报告
);
转成c#调用:
[DllImport( "SMEIDLL.dll ", CharSet=CharSet.Ansi)]
protected static extern int GetDeliverSMExExEx(
out ulong sm_ID,
[MarshalAs(UnmanagedType.U1)] out byte DestTON,
[MarshalAs(UnmanagedType.U1)] out byte DestNPI,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder DestAddr,
[MarshalAs(UnmanagedType.U1)] out byte OrgTON,
[MarshalAs(UnmanagedType.U1)] out byte OrgNPI,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder OrgAddr,
[MarshalAs(UnmanagedType.U1)] out byte PRI,
[MarshalAs(UnmanagedType.U1)] out byte RP,
[MarshalAs(UnmanagedType.U1)] out byte UDHI,