高手帮忙救急了,关于短信接收的一个小问题
public struct ReceiveMsg
{
public string mobile;
public string senderaddi;
public string recvaddi;
public string ct;
public string sd;
public int flag;
}
private static void getSMSContent(string mobile,string senderaddi, string recvaddi,string ct,string sd,ref int flag)
{
string content = mobile;
int myflag = flag;
}
public delegate void deleSQF(string mobile,string senderaddi, string recvaddi,string ct,string sd,ref int flag);
deleSQF mySmsContent = new deleSQF(getSMSContent);
/// <summary>
/// 接收
/// </summary>
/// <param name="sn"></param>
/// <returns>997 998 999 其它为内容 形式为: 手机号|内容|时间||手机号|内容|时间||</returns>
[DllImport("EUCPComm.dll",EntryPoint="ReceiveSMS")]
public static extern int ReceiveSMS(string sn,deleSQF mySmsContent);
[DllImport("EUCPComm.dll",EntryPoint="ReceiveSMSEx")]
public static extern int ReceiveSMSEx(string sn,deleSQF mySmsContent);
//接收短信
private void Button5_Click(object sender, System.EventArgs e)
{
string sn=System.Configuration.ConfigurationSettings.AppSettings["SN"].ToString().Trim();
ReceiveMsg recMsg=new ReceiveMsg();
deleSQF mySmsContent = new deleSQF(getSMSContent);
int result=ReceiveSMSEx(sn, mySmsContent);
//int result=MMS.ReceiveSMSEx(sn,mySmsContent);
this.Label5.Text="result="+result.ToString();
if(result==1)
{
this.Label4.Text="无短信接收";
}
else if(result==2)
{
this.Label3.Text="收到短信";
if(recMsg.flag==1)
{
this.Label4.Text="手机号码:"+recMsg.mobile+"短信内容:"+recMsg.ct+"接收时间:"+recMsg.sd;
}
else
this.Label4.Text="无内容";
}
else
{
this.Label4.Text="失败";
}
}
我做的一个短信接收的代码,老是接收不到短信,请各位高手帮忙看一下,特别是这几句
ReceiveMsg recMsg=new ReceiveMsg();
deleSQF mySmsContent = new deleSQF(getSMSContent);
int result=ReceiveSMSEx(sn, mySmsContent);
为什么老是接受不到短信的内容呢
是不是有什么问题, 拜托了。