NOKIA手机发送短信奇怪问题
代码如下:
using STTNGS3A_SLib;
using NokiaCLMessaging;
using System.Text;
public void send_sms(string sms_number, string sms_content)//参数为数据号码和发送内容
{
try
{
STTNGS3A_SLib.PhoneInfo_Suite3 PhoneStatus = new STTNGS3A_SLib.PhoneInfo_Suite3();
STTNGS3A_SLib.DevNotifyOpt devStatus;
PhoneStatus.get_DeviceStatus(out devStatus);//判断手机是否连接到PC上
if (devStatus.ToString() == "ATTACHED ")
{
NokiaCLMessaging.ShortMsgAdapter smsObj = new NokiaCLMessaging.ShortMsgAdapterClass();
NokiaCLMessaging.ShortMessageItem smsEntry = new NokiaCLMessaging.ShortMessageItemClass();
smsEntry.Type = NokiaCLMessaging.ShortMessageType.SHORTMESSAGE_TYPE_GSM_SUBMIT;
IGSMSubmit submitObj = (IGSMSubmit)smsEntry.TypeProperties;
//转换编码
UnicodeEncoding Ustring = new UnicodeEncoding();
byte[] input = Ustring.GetBytes(sms_content.Trim());
sms_content = System.Text.Encoding.Unicode.GetString(input);
submitObj.Message = sms_content;
submitObj.DestinationAddress = sms_number.Trim();
submitObj.ServiceCenterAddress = sms_center.Text.Trim();//短信中心号码
submitObj.DataCodingScheme = 8;//使用Unicode编码
submitObj.ValidityPeriodRelative = 255;
submitObj.ProtocolID = 0;
smsObj.SendSMS(ShortMessageRouteType.SHORTMESSAGE_ROUTE_TYPE_ANY,submitObj);//发送短信
MessageBox.Show( "短信发送成功! ");
}
else
{
MessageBox.Show( "没有找到连接的手机! ");
}
}
catch (Exception x)
{
MessageBox.Show( "错误: " + x.ToString(), "系统提示: ");
}
}
执行
send_sms( "+86137******** ", "qqqqqqqqqqqqqqqqq ", "+861380010500 ");
提示以下错误
System.Runtime.InteropServices.COMException(0x80004005):Message send failed
请问怎么调试...急!!!
------解决方案--------------------组件内部错误,只能看组件帮助查错误信息
------解决方案--------------------没用过了
帮ding
------解决方案--------------------单步调试下,进SendSMS里面看看
------解决方案--------------------smsObj有源码没有,用源码调试吧