Tuesday, January 1, 2013
How to Send Receive an SMS Using VB 6
1. Download and install SMSLibx. You will need to register for an account before the SMS library download is allowed. Once registration and download are complete, double-click the file to launch the installation wizard. Follow the instructions on the screen with the default settings.
2. Launch Visual Basic Studios. Click 'Start,' 'All Programs,' 'Visual Basic Studios,' 'Visual Basic Editor.' The code editing software will appear on the screen.
3. Access the SMS library via the reference list. Click 'Project,' 'References,' then select SMSLibx from the reference list and click 'OK.'
4. Create the SMS modem object via a VB 6 declaration. In the code editor, type:Public WithEvents Modem As SMSModem
5. Create a function to send messages in VB 6. In the code editor, below the line from the previous step, type: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
6. Create a function to receive messages in VB 6. In the code editor, below the send message function code, type:Private Sub nowRecieiveSMSMessage(Message As SMSLibX.SMSDeliver)MsgBox 'New message received from ' & Message.Originator & ':' _& vbCrLf & vbCrLf & Message.Body, _vbInformation, 'New message received'End Sub
7. Save the project. Click 'Project,' 'Save,' navigate to the 'Documents' directory, then give the file a name and save it in VB format (the extension will be .vbscript). For example, the name could be sms.vbscript.
8. Launch the command prompt. Click 'Start,' 'Run,' type 'CMD.EXE' then press 'Enter.'
9. Send an SMS message via VB 6. At the command prompt, for example type 'c:\Documents\sms.vbscript nowSendSMSMessage('5555555555', 'this is a message')' then press 'Enter.' The message will be sent to the number.
10. Receive SMS messages. At the command prompt, type 'c:\Documents\sms.vbscript nowReceiveSMSMessage()' then press 'Enter.' The computer will wait for an SMS message to be displayed.
No comments:
Post a Comment