谁能把下面的c#代码转换为delphi代码 ( 积分: 100 )

  • 主题发起人 主题发起人 smallfox
  • 开始时间 开始时间
S

smallfox

Unregistered / Unconfirmed
GUEST, unregistred user!
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(),"系统提示:");
}
}
 
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(),"系统提示:");
}
}
 
STTNGS3A_SLib;
NokiaCLMessaging;
这个都没有,怎么转呀!
 
这是Nokia SDK 3.0 开发包。(NCLmsg.dll,stngs3AS.dll)
用delphi导入后产生的pas文件。
您可以到 http://www.csdn.net/mobile/nokia/ListNCSP.aspx?dc_subject=Nokia+PC+Connectivity+SDK
去下载Nokia的开发包
 
后退
顶部