|
SMSActiveX
方法说明文档
在这个文档中主要介绍SMSActivex控件一些重要方法。对一些特别重要的方法,给出相应的用例
1 CheckConnection
声明
Delphi:function CheckConnection:
Boolean;
Visual Basic:Private Sub CheckConnection
as Boolean
描述
CheckConnection这个方法返回手机是否在线.
如果函数返回false,
那么可以调用Open方法.
2 CheckRTTTL
声明
Delphi: CheckRTTTL(sRTTTL:string):
Integer;
Visual Basic:Private Sub
CheckRTTTL(ByVal sRTTTL as string) as Long
描述
使用这个方法检查这个字符串SendRingtone传过来的.
3 Close
声明
Delphi:procedure Close;
Visual Basic:Private Sub Close()
描述
Close这个方法是用于结束连接,关闭串行端口.如果已经关闭,调用Close是安全的。
4 DeleteSMSMessage
声明
Delphi: function DeleteSMSMessage(Index:
integer): Boolean;
Visual Basic: Private Sub
DeleteSMSMessage(ByVal Index as Long) as Boolean
描述
使用DeleteSMSMessage
方法从手机中删除指定短信.
如果操作成功,方法返回True.
该方法的例子:
Delphi:
i := 1;
If SMS.DeleteSMSMessage(i) = True then
ShowMessage('Message #' + IntToStr(i) + ' is deleted');
Visual Basic:
i = 1
If SMS.DeleteSMSMessage(i) = True then
MsgBox('Message #' & i & ' is deleted');
End If
5 GetLastName
声明
Delphi: function
GetLastName(LastType,Index:integer):string;
Visual Basic: Private Sub
GetLastName(ByVal LastType as Long, ByVal Index as Long) as string
描述:
使用这个方法获得最新的拨号,
已接的或者未接的号码.
方法的参数:
参数值:
0 -
已拨的号码
1 -
已接的号码
2 -
未接的号码
Index
是指明在call数组中位置。通常一个电话每个目录可以存储8到
10 . Index从1开始计数.
这个方法的结果是一个字符串.
注意,
如果caller不在你的电话簿中,或者你手动拨号这个方法返回空串.
6 GetLastNumber
声明
Delphi: function
GetLastNumber(LastType,Index:integer):string;
Visual Basic: Private Sub
GetLastNumber(ByVal LastType as Long, ByVal Index as Long) as string
描述
使用这个方法获取最新的拨号、已接和未接的电话号码。
方法参数:
类型:
0 –
拨号
1 –
已接
2 –
未接
Index
号码数组中的位置。通常每个目录可以存储8到10个电话号码。
这个方法返回值是指定位置Index的该类型的电话号码。
7 GetSMSCNumber
声明
Delphi function GetSMSCNumber: string;
Visual Basic: Private Sub GetSMSCNumber
as string
描述:
GetSMSCNumber方法从手机中读取中心号码。
如果失败,将返回空串。
8 Open
声明
Delphi: function Open: Boolean;
Visual Basic: Private Sub Open as
Boolean
描述:
Open这个方法使用来打开连接手机的串行端口。你需要设定串口端口号和连接模式。如果连接成功返回True,否则返回False。
注意:如果连接失败,你需要调用Close方法去关闭这个串行端口。
这个方法的例子
Delphi:
SMS.ComNumber := 2;
SMS.ConnectionMode := 0;
If SMS.Open then ShowMessage('Connection
successful')
Else Begin
SMS.Close;
ShowMessage('Connection failed');
End;
Visual Basic:
SMS.ComNumber = 2
SMS.ConnectionMode = 0
If SMS.Open Then
MsgBox("Connection successful")
Else: SMS.Close
MsgBox("Connection failed")
EndIf
9 ReadSMSMessage
声明
Delphi: function ReadSMSMessage(Index:
Longint): Boolean;
Visual Basic: Private Sub
ReadSMSMessage(ByVal Index as Long) as Boolean
描述:
使用这个方法来读取短信。如果读取成功返回True。
所有的短信参数都放到LastReadSMS
属性组中。
方法参数:
Index –所读短信的位置;
LastReadSMSMsgType –
短信类型是短信还是报告
LastReadSMSText –
包含信息文本
LastReadSMSDelivery –
如果这条SMS
是一个报告,这个参数表明发送状态。
发送状态值:
0 –
已发送
1 –
未发送
2 –
正在发送
3 –
未发送
LastReadSMSSend –
发送人的电话号码
LastReadSMSTime –
短信时间
如果短信中包含图片,控制台将会试图去保存它为一个文件。
这个方法的例子
Delphi:
i := 1;
SMS.WriteSMSPictName = 'd:!' +
IntToStr(i) + '.bmp'
If SMS.ReadSMSMessage(i) Then
begin
Label12.caption = "Text: " &
SMS.LastReadSMSText;
Label13.caption = "From: " &
SMS.LastReadSMSSend;
Label14.caption = "Date: " &
Time(DateTime);
end
Else ShowMessage ('Slot ' + i + ' is
empty)
Visual Basic:
Dim DateTime As Date
..
i = 1
SMS.WriteSMSPictName = "d:!" & i &
".bmp"
If SMS.ReadSMSMessage(i) Then
Label12 = "Text: " &
SMS.LastReadSMSText
Label13 = "From: " &
SMS.LastReadSMSSend
DateTime = SMS.LastReadSMSTime
Label14 = "Date: " & DateTime
Else: MsgBox ("Slot " & i & " is
empty")
End If
10 ResetOperatorLogo
声明
Delphi:
ResetOperatorLogo(MCC,MNC:integer):Boolean;
Visual Basic: Private Sub
ResetOperatorLogo(MCC as Long, MNC as Long) as Boolean
描述:
这个方法从手机中重置操作者的logo。
方法参数:
MCC, MNC –
国家和网络号码.
11 ResetStartupLogo
Delphi: ResetStartupLogo:Boolean;
Visual Basic: Private Sub
ResetStartupLogo as Boolean
描述:
这个方法是用来重置手机中操作者的logo
。
12 SaveOperatorLogo
声明:
Delphi: SaveOperatorLogo(MCC,MNC:integer;
PictName:string):Boolean;
Visual Basic:
Private Sub SaveOperatorLogo(MCC as
Long, MNC as Long, PictName as string) as Boolean
描述:
这个方法允许你上载操作者的Logo到手机中去。
方法参数:
MCC, MNC –
国家和网络号码
Picture –
上传图片的路径。
13 SaveStartupLogo
声明
Delphi:
SaveStartupLogo(PictName:string):Boolean;
Visual Basic:
Private Sub SaveStartupLogo(PictName as
string) as Boolean
描述:
这个方法允许你保存Sturtup logos到你的手机中
14 SaveRingtone
声明
Delphi:
function SaveRingtone(RTTTL:string;
Destination: integer):Boolean;
Visual Basic:
Private Sub SaveRingtone(ByVal RTTTL as
string, ByVal Destination as Long) as Boolean
描述:
这个方法保存一个RTTTL
格式的铃声到指定的位置。
15 SendCLILogo
声明
Delphi: SendCLILogo(PhoneNumber:string;
Validity:Byte; NeedReport:Boolean; PictName:string
):Boolean;
Visual Basic:
Private Sub SendCLILogo(ByVal
PhoneNumber as string, ByVal Validity as Long, ByVal NeedReport as Boolean,
PictName as string) as Boolean
描述:
这个方法允许你发送CLI logos.
方法参数:
PhoneNumber –
收信人手机号
Validity –
指明手机有效期
NeedReport –
报告需求参数
Picture –
发送图片位置
16 SendFlashMessage
声明
Delphi:
function
SendFlashMessage(PhoneNumber:string; Text:WideString; Validity:integer;
NeedReport:Boolean):Boolean;
Visual Basic:
Private Sub SendFlashMessage(ByVal
PhoneNumber as string, ByVal Text as string, ByVal Validity as byte, ByVal
NeedReport as Boolean) as Boolean
描述:
这个方法发送Text变量存储文本的闪动短信。
PhoneNumber –
手机号码
闪动文字tags:
<F> 开始闪动</F>
停止。
例如:
<F>SMS</F> ActiveX <F>Control</F>,
Validity
-短信有效期
NeedReport
报告要求参数
闪动短信只能在老式的Nokia手机使用。
17 SendOperatorLogo
声明
Delphi:
:(PhoneNumber:string;
MCC,MNC:integer; Validity:Integer; NeedReport:Boolean; PictName:string):Boolean;
Visual Basic:
Private Sub SendOperatorLogo(ByVal
PhoneNumber as string, MCC as Long, MNC as Long, ByVal Validity as Long, ByVal
NeedReport as Boolean, PictName as string) as Boolean
描述:
这个方法允许你发送操作者logo.
18 SendRingtone
描述:
SendRingtone
发送RTTTL格式的铃声
20 SendSMSMessage
声明
Delphi:
function SendSMSMessage(PhoneNumber:
string; Text: string; Validity: byte; NeedReport, IsUnicode: Boolean; Picture:
string): Boolean;
Visual Basic:
Private Sub SendSMSMessage(ByVal
PhoneNumber as string, ByVal Text as string, ByVal Validity as byte, ByVal
NeedReport as Boolean, ByVal IsUnicode as Boolean; Picture as string) as Boolean
描述:
这个方法是向指定的手机发送短信。
PhoneNumber –
对方手机号码
Validity
有效期
0..143: 5分钟到12
小时 - i.e.
(Validity +1) * 5minutes
144..167: 12小时到24小时
168..196: 2天到30天
197..255: 5周到63周
NeedReport
报告要求参数
IsUnicode
文本UNICODE编码
这个方法的例子
Delphi:
var SendPic : string;
...
SMS.SetSMSCNumber('+70957699100');
SendPic := 'C:Logo.bmp';
if SMS.SendSMSMessage('+79021234567', 'www.mailer.com.cn',
6, True, False, SendPic) = true then ShowMessage('Message sent')
else ShowMessage('Message NOT sent');
Visual Basic:
Dim SendPic as string
...
SMS.SetSMSCNumber("+70957699100")
SendPic = "C:Logo.bmp"
if SMS.SendSMSMessage("+79021234567", "www.mailer.com.cn",
6, True, False, SendPic) = true then MsgBox('Message sent')
else: MsgBox("Message NOT sent")
endif
21 SendUnicodeSMSMessage
声明
Delphi:
function
SendUnicodeSMSMessage(PhoneNumber: string; Text: string; Validity: byte;
NeedReport: Boolean; Picture: string): Boolean;
Visual Basic:
Private Sub SendUnicodeSMSMessage(ByVal
PhoneNumber as string, ByVal Text as string, ByVal Validity as byte, ByVal
NeedReport as Boolean, Picture as string) as Boolean
描述:
SendUnicodeSMSMessage这个方法发送UNICODE文本到指定手机。
PhoneNumber-对方手机号码.
Text
-UNICODE编码的文本。
Validity
有效期
0..143: 5分钟到12
小时 - i.e.
(Validity +1) * 5minutes
144..167: 12小时到24小时
168..196: 2天到30天
197..255: 5周到63周
NeedReport
报告要求参数
注意:
你可以用SendSMSMessage
方法发送 Unicode
文本,他将转换ASCII
字符串为Unicode.
这个方法的例子
Delphi:
var SendPic : string;
...
SMS.SetSMSCNumber('+70957699100');
SendPic := 'C:Logo.bmp';
if SMS.SendUnicodeSMSMessage('+79021234567',
'www.mailer.com.cn', 6, True, SendPic) then ShowMessage('Message sent')
else ShowMessage('Message NOT sent');
Visual Basic:
Dim SendPic as string
...
SMS.SetSMSCNumber("+70957699100")
SendPic = "C:Logo.bmp"
if SMS.SendSMSMessage("+79021234567", "www.mailer.com.cn",
6, True, SendPic) = true then MsgBox('Message sent')
else: MsgBox("Message NOT sent")
endif
22 SetSMSCNumber
声明
Delphi:
procedure SetSMSCNumber(PhoneNumber:
string);
Visual Basic: Private Sub
SetSMSCNumber(ByVal PhoneNumber As String)
描述:
这方法是用来设定手机的中心号码。
Delphi:
SMS.SetSMSCNumber('+44547545');
Visual Basic:
call SMS.SetSMSCNumber("+44547545");
|