日期:2014-05-19  浏览次数:20833 次

请教达人啊,cmpp的问题
vc做的dll文件中函数原型int   Cmpp_Getdeliver(
unsigned   char   Msg_Id[8],   char   Dest_Id[21],   char   Service_Id[10],  
unsigned   char   *TP_pid,   unsigned   char   *TP_udhi,   unsigned   char   *Msg_Fmt,   char   Src_terminal_Id[32],   unsigned   char   *Src_terminal_type,
unsigned   char   *Registered_Delivery,   char   *Msg_Content,  
int   *nBufferLen,   unsigned   char   Link_ID[20]
);
返回值:0成功取得一条短信;-1版权错误;....
使用说明:读取下发短信的内容

请问:在C#里是否是如此定义?但如何取到短信的内容?请达人给出相应代码啊,万分感谢为念,实在是急.....
[DllImport( "LongSms.dll ",EntryPoint= "Cmpp_Getdeliver ",SetLastError=true,CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]    
//读取下发消息内容
public   static   extern   int   Cmpp_Getdeliver(
[Out]   StringBuilder   Msg_Id,   [Out]   StringBuilder   Dest_Id,   [Out]   StringBuilder   Service_Id,   [Out]   StringBuilder   TP_pid,
[Out]   StringBuilder   TP_udhi,   [Out]   StringBuilder   Msg_Fmt,  
[Out]   StringBuilder   Src_terminal_Id,   [Out]   StringBuilder   Src_terminal_type,[Out]   StringBuilder   Registered_Delivery,   [Out]   StringBuilder   Msg_Content,   [Out]   StringBuilder   nBufferLen,   [Out]   StringBuilder   Link_ID
);
}

------解决方案--------------------
[Out]都去掉。

StringBuilder 先申请空间

StringBuilder sb = new StringBuilder(512);