SMS messaging, also known as text messaging, continues to grow in popularity. It is now used in emergency alert systems for college campuses and cities. Mobile banking has also incorporated SMS messaging. Computer programmers are finding SMS access increasingly important. New libraries created for Visual Basic 6 (VB 6) streamline the process of writing and receiving SMS messages. With the SMS services in place, programmers can incorporate messaging as a new interface for communicating with users.
- Skill level:
Other People Are Reading
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.
Launch Visual Basic Studios. Click "Start," "All Programs," "Visual Basic Studios," "Visual Basic Editor." The code editing software will appear on the screen.
Access the SMS library via the reference list. Click "Project," "References," then select SMSLibx from the reference list and click "OK."
Create the SMS modem object via a VB 6 declaration. In the code editor, type:
Public WithEvents Modem As SMSModem
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 communication
Set Modem = New SMSModem
Modem.LogTrace = True
Modem.OpenComm ModemType, ModemPort, , smsNotifyAll
' Send message
Call Modem.SendTextMessage(PhoneNumber, MessageText)
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"
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.
Launch the command prompt. Click "Start," "Run," type "CMD.EXE" then press "Enter."
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.
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.
Tips and warnings
- These functions can be incorporated into Web applications for streamline communication.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for