|
Public Sub SendSMS(ByVal Number As String, ByVal Message As String)
Dim SMSHandle As Long Dim SMSEvent As Long Dim SMSAddress As String Dim SMSProvider As String
'打开SMS消息组件 Call SmsOpen(SMS_MSGTYPE_TEXT, SMS_MODE_SEND, SMSHandle, SMSEvent)
'设置地址结构体 SMSAddress = LongToBytes(SMSAT_INTERNATIONAL) & Number
'设置提供者结构体 SMSProvider = LongToBytes(PS_MESSAGE_OPTION_NONE) & _ LongToBytes(PS_MESSAGE_CLASS0) & _ LongToBytes(PSRO_NONE)
'发送消息 If 0 = SmsSendMessage(SMSHandle, 0, SMSAddress, 0, Message, _ LenB(Message), SMSProvider, 12, SMSDE_GSM, _ SMS_OPTION_DELIVERY_NONE, 0) Then MsgBox "Message sent!", vbInformation, App.Title Else MsgBox "Could not send message!", vbCritical, App.Title End If
'关闭SMS消息组件 Call SmsClose(SMSHandle)
End Sub
|