»áÔ±£º ÃÜÂ룺 ¡¡Ãâ·Ñ×¢²á | Íü¼ÇÃÜÂë | »áÔ±µÇ¼ ÍøÒ³¹¦ÄÜ£º ¼ÓÈëÊÕ²Ø ÉèΪÊ×Ò³ ÍøÕ¾ËÑË÷  
¼¼ÊõÎĵµ > VBÎĵµ > ÍøÂç±à³Ì
ÓÃPocketPCPhoneÌæ´úATÖ¸ÁîµÄÊÖ»úSMS·þÎñ
·¢±íÈÕÆÚ£º2004-03-02 00:00:00×÷Õߣº× ³ö´¦£º  

ÐÂÐÍPocket PCµç»°°æÒѽ«Pocket PCËù¾ß±¸µÄÈ«²¿¾«ÃîÌØÐÔͬ×îе绰¹¦Äܼ¯ÓÚÒ»Éí£¬ÎÒÃǸõ½ÌÔÌ­ÀÏʽÊÖ»úµÄʱºòÁË¡£

¹ú²úÁªÏë ET180, dopod 696£¬dopod 686 µÈ£¬¶¼ÊÇ Pocket PC PhoneÖеľ«Æ·£¬ÇÒ ET180ÖйشåÊÛ¼Û¼º¾­½µÖÁ £¤3700Ôª£¡

¿´µ½´ó¼ÒÔÚÆÆ8850µÈ»úÆ÷ÉÏÕÛÌÚATÖ¸Á±àд¶ÌÐÅÊÕ·¢³ÌÐò£¬ÎҸе½Íò·ÖÄѹý¡£ ÓÐÕâôºÃÓÃµÄ Pocket PC Phone,Ϊʲô»¹ÒªÓÃATÖ¸ÁµÄÆÆÍæÒâ¶ùÄØ£¿

²ÉÓÃATÖ¸Á±àд¶ÌÐÅÊÕ·¢³ÌÐò£¬ÐèÒª½â¾öÐí¶à¼¼ÊõÄÑÌâºÍ·Ç¼ÆËãÄÑÌ⣬ÄÜÕÛÌÚÄãºÃÒ»Õó×Ó£¬ÎÒÃǾͲ»ËµÁË¡£¼ÓÉÏһЩ²»·¨ÉÌ··ÀÏÊÇÔÚÍøÉϵ¹ÌÚЩ¿Ø¼þÔÚ¶µÊÛ£¬ÎÒÎÞ·¨ÈÌÊÜÁË£¡

ÕâÀïÎÒÌṩÁËÁíÍâÒ»ÖÖ;¾¶·¢ËÍÖÐÎĶÌÐÅ£¬²¢¸ø³öÈ«²¿Ô´Â룬¹©´ó¼ÒÏÂÔØ¡£

ET180 PPC»úºÍ¶àÆÕ´ïÊÖ»úÖУ¬º¬ÓÐÇ¿´óµÄWINCE²Ù×÷ϵͳ£¬¿ÉÒÔʹÓÃWINCE²Ù×÷ϵͳµÄ¿ª·¢¹¤¾ß¿ª·¢³öÒ»¸ö¼òµ¥µÄ¶ÌÐÅ·¢ËͳÌÐò¡£

»·¾³£º   ÁªÏëet180»úÆ÷£¬²Ù×÷ϵͳPocket 2002, ¿ª·¢¹¤¾ßΪeVB3.0

Ô´´úÂ룺

1¡¢´´½¨Ò»¸öModules: SMSMessage

Ô´ÂëÈçÏ£º

Option Explicit

' API declarations

Public Declare Function SmsOpen Lib "SMS" (ByVal ptsMessageProtocol As String, ByVal dwMessageModes As Long, ByRef psmshHandle As Long, ByRef phMessageAvailableEvent As Long) As Long

Public Declare Function SmsSendMessage Lib "SMS" (ByVal smshHandle As Long, ByVal psmsaSMSCAddress As Long, ByVal psmsaDestinationAddress As String, ByVal pstValidityPeriod As Long, ByVal pbData As String, ByVal dwDataSize As Long, ByVal pbProviderSpecificData As String, ByVal dwProviderSpecificDataSize As Long, ByVal smsdeDataEncoding As Long, ByVal dwOptions As Long, ByRef psmsmidMessageID As Long) As Long

Public Declare Function SmsClose Lib "SMS" (ByVal smshHandle As Long) As Long

' API constants

Public Const SMS_MSGTYPE_TEXT = "Microsoft Text SMS Protocol"

Public Const SMS_MODE_SEND = 2       ' Open in send mode

Public Const SMSDE_GSM = 0         ' Use Unicode GSM encoding

Public Const SMSAT_INTERNATIONAL = 1    ' International number format

Public Const PS_MESSAGE_OPTION_NONE = 1  ' message options

Public Const PS_MESSAGE_CLASS0 = 0     ' Send immediately

Public Const PSRO_NONE = 0         ' No replacements

Public Const SMS_OPTION_DELIVERY_NONE = 0 ' No delivery options

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

 

 ' Open SMS Messaging Component

 If 0 <> SmsOpen(SMS_MSGTYPE_TEXT, SMS_MODE_SEND, SMSHandle, SMSEvent) Then

  MsgBox "Could not open SMS component!", _

      vbCritical, App.Title

  Exit Sub

 End If

 ' Set Address structure (UDT as string)

 SMSAddress = LongToBytes(SMSAT_INTERNATIONAL) & Number

 ' Set Provider structure (UDT as string)

 SMSProvider = LongToBytes(PS_MESSAGE_OPTION_NONE) & _

        LongToBytes(PS_MESSAGE_CLASS0) & _

        LongToBytes(PSRO_NONE)

 ' Send message

 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

  MsgBox "¶ÌÐÅÏ¢·¢Ëͳɹ¦!", vbInformation, App.Title

 Else

  'MsgBox "Could not send message!", vbCritical, App.Title

  MsgBox "¶ÌÐÅÏ¢·¢ËÍʧ°Ü!", vbCritical, App.Title

 End If

 

 ' Close SMS Messaging Component

 If 0 <> SmsClose(SMSHandle) Then

  'MsgBox "Could not close SMS component!", vbCritical, App.Title

  MsgBox "ÎÞ·¨¹Ø±Õ¶ÌÐÅÏ¢×é¼þ!", vbCritical, App.Title

  Exit Sub

 End If

End Sub

Function LongToBytes(ByVal Value As Long) As String

 

 Dim lsHex As String, i As Integer

 

 lsHex = Right("00000000" & Hex(Value), 8)

 For i = 1 To 7 Step 2

  LongToBytes = ChrB(CInt("&H" & Mid(lsHex, i, 2))) & LongToBytes

 Next

End Function

Function BytesToLong(ByVal Value As String) As Long

 

 Dim lsHex As String, i As Integer

 

 For i = 1 To 4

  lsHex = Hex(AscB(MidB(Value, i, 1))) & lsHex

 Next

 BytesToLong = CLng("&H" & lsHex)

End Function

2¡¢´´½¨Ò»¸ö´°Ì壬frmSMS

°üº¬Á½¸öÎı¾¿ò£¬Ò»¸ö°´Å¥£¬Ô´ÂëÈçÏ£º

Private Sub Command1_Click()

  SendSMS txtNumber.Text, txtMessage.Text

End Sub

´ó¼Ò¿ÉÒÔÓÃwinSock±àдһ¸öС³ÌÐò£¬ÊµÏÖPPCºÍPCÖ®¼äµÄͨѶ£¬´ïµ½°Ñet180»úÆ÷×÷Ϊ¶ÌÐÅÖÐÐĵÄÄ¿µÄ£¬ÊµÏÖÈç°ì¹«×Ô¶¯»¯ÏµÍ³Ö®ÀàµÄÓ¦ÓÃÈí¼þ ÊÖ»ú¶ÌÐÅÊÕ·¢¹¦ÄÜ¡£

´ó¼ÒÈçÓм¼Êõ·¢ÃæµÄÒâ¼û½¨Ò飬Çëµ½MSN(mr_hsx@hotmail.com £¬Seala@126.com)ÉÏÁªÏµ¡£

¡¾·µ»Ø¶¥²¿¡¿ ¡¾´òÓ¡±¾Ò³¡¿ ¡¾¹Ø±Õ´°¿Ú¡¿

¹ØÓÚÎÒÃÇ / ¸øÎÒÁôÑÔ / °æȨ¾Ù±¨ / Òâ¼û½¨Òé / ÍøÕ¾±à³ÌQQȺ   
Copyright ©2003- 2024 Lihuasoft.net webmaster(at)lihuasoft.net ¼ÓÔØʱ¼ä 0.00471