Saturday, April 5, 2014
How to Receive an SMS Using Visual Basic
1. Install SMSLibx, following the instructions with the install wizard. You can download SMSLibx online (see Resources).
2. Start your copy of Visual Basic to load the application. Click on 'Projects' from the main menu, then select 'References.' Locate 'SMSLibx' in the reference list and highlight it. Click 'OK.'
3. Make a Visual Basic declaration. This will be your SMS object. Once you have access to the declaration code editor, type the following:Public WithEvents Modem As SMSModem
4. Input the following code just under the code you typed out in Step 3. This will be the function that sends your messages. Type out:Private Sub nowSendSMSMessage(PhoneNumber, MessageText)' Open modem communicationSet Modem = New SMSModemModem.LogTrace = TrueModem.OpenComm ModemType, ModemPort, , smsNotifyAll' Send messageCall Modem.SendTextMessage(PhoneNumber, MessageText)End Sub
5. Input the following code just below the code added in Step 4. This will be the function to receive SMS messages. Type out:Private Sub nowRecieiveSMSMessage(Message As SMSLibX.SMSDeliver)MsgBox 'New message received from ' & Message.Originator & ':' _& vbCrLf & vbCrLf & Message.Body, _vbInformation, 'New message received'End Sub
6. Click on 'Project,' then select 'Save' from the menu bar to save your document. With the 'Save' window open, locate the 'Documents' directory, name the file 'Messenger.vbscript' and click 'Save.'
7. Click the Windows 'Start' menu in the lower left of your desktop, type 'CMD.exe' and press 'Enter' to open the Command Prompt in Windows Vista and later. In Windows XP and earlier, click 'Start,' click 'Run,' type 'CMD.exe' and press 'Enter.'
8. Type the following in the Command Prompt, then press 'Enter' to send a message:c:\Documents\Messenger.vbscript nowSendSMSMessage('the phone number', 'input the message you want to send here')
9. Receive messages by inputting the following text into the Command Prompt and pressing 'Enter':c:\Documents\Messenger.vbscript nowReceiveSMSMessage()This will let your computer wait for messages to come in.
10. Repeat Steps 8 and 9 to have a conversation.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment