You are on page 1of 4

Using The SMS and MMS Toolkit with Visual Basic 5.x/6.

x
The SMS and MMS Toolkit is a software development kit (SDK) to enhance an application or script with SMS, MMS and Pager functionality. SMS messages can be sent using a GSM/GPRS modem, an SMPP provider, an HTTP compliant SMS provider or using a standard dialup or fixedline SMS modem. MMS messages can be sent via a GSM/GPRS modem (MM1), an SMTP server (MM4) or an XML/SOAP compliant provider (MM7). SMS features:

Send and receive numeric- and alphanumeric text SMS messages Verify delivery of outgoing SMS messages Support for multimedia SMS messages, including ringtones, pictures and logo's Support for WAP Push, WAP Bookmarks, vCards, voicemail/e-mail/fax/MMS indications Support for Unicode, to support foreign languages like Arabic, Chinese, Turkisch, etc. Support for multi-part messages, to allow messages longer than 160 characters Support for GSM modems, GSM phones, SMS/HTTP providers, SMPP (Short Message Peer to Peer) providers, TAP/XIO and UCP dial-in SMSC providers Support Multi-threading environments. The component is thread-safe, which means it can be used in a multi-threaded environment Samples included for various development platforms: MS Visual Basic, MS Visual Basic .NET, MS Visual C++, MS Visual Studio C# .NET, ASP, ASP .NET, Borland Delphi, Borland C++ Builder, ColdFusion and more

MMS features:

Support for many multimedia formats incl.: JPG, GIF, PNG, BMP, WBMP, TIF, WAV, MP3, MIDI, AC3, GP3, AVI, MPG, MP4, VCARD, VCALENDAR, JAR and more Support for MM1 (MMS over WAP), MM4 (MMS over SMTP) and MM7 (MMS over HTML/SOAP)

Pager features:

Send alpha-numeric Pager messages through SNPP

This document describes how the SMS and MMS Toolkit can be integrated into Visual Basic 5.x/6.x projects.

Step 1: Download and install The SMS and MMS Toolkit


Download the SMS and MMS Toolkit from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.

Step 2: Create a new Visual Basic project


Launch 'Microsoft Visual Basic' from the Start menu, and choose 'New' from the 'File Menu'. The 'New Project' dialog appears. Select 'Standard Exe' and click 'OK':

(Click on the picture to enlarge)

Step 3: Refer to the SMS and MMS Toolkit Library


A new Project is created, with a blank form. First, you must add a reference to the SMS and MMS Toolkit in the project to be able to use the SMS objects. To do so, choose 'References...' from the 'Project' menu. In the 'References' dialog that pops up, enable the ActiveXperts SMS and MMS Toolkit Type Library' reference as shown in the following picture:

(Click on the picture to enlarge) Click 'OK' to close the 'References...' dialog. Then, select the Project form and choose 'View Code' from the context menu:

(Click on the picture to enlarge) On top of your code, declare the following objects:
Dim objGsmProtocol As AXmsCtrl.SmsProtocolGsm Dim objSmsMessage As AXmsCtrl.SmsMessage Dim objSmsConstants As AXmsCtrl.SmsConstants

Step 4: Declare and create the objects


From the Code window, select 'Form'. The Private Sub 'Form_Load()' will be displayed now. In the 'Form Load' function, create the GSM objects in the following way:
Set objGsmProtocol = CreateObject("ActiveXperts.SmsProtocolGsm") Set objSmsMessage = CreateObject("ActiveXperts.SmsMessage") Set objSmsConstants = CreateObject("ActiveXperts.SmsConstants")

Step 5: Send SMS messages


The following code snippet shows how to send an SMS message using a connected GSM phone or modem:
Private Sub buttonSend_Click() Dim Format As Long buttonSend.Enabled = False textResult.Caption = "Sending message, Please wait..." textResult.Refresh ' Set Device objGsmProtocol.Device = comboDevice.Text ' Set LogFile objGsmProtocol.LogFile = textLogfile.Text ' Set Speed

If comboSpeed.ListIndex = 0 Then objGsmProtocol.DeviceSpeed = 0 ' use default speed Else objGsmProtocol.DeviceSpeed = comboSpeed.List(comboSpeed.ListIndex) End If ' Set Format objSmsMessage.Format = objConstants.asMESSAGEFORMAT_TEXT If SendConfig.checkMultipart.Value = 1 Then objSmsMessage.Format = objConstants.asMESSAGEFORMAT_TEXT_MULTIPART End If If SendConfig.checkFlash.Value = 1 Then objSmsMessage.Format = objConstants.asMESSAGEFORMAT_TEXT_FLASH End If ' Set Delivery Report objSmsMessage.RequestDeliveryStatus = SendConfig.checkReport.Value ' Set recipient objSmsMessage.Recipient = textRecipient.Text ' Set Message parameters objSmsMessage.Data = textMessage.Text ' Send the message objGsmProtocol.Send( objSmsMessage ) ' Display result ShowReference = True GetResult (True) ShowReference = False buttonSend.Enabled = True End Sub

There are many working samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/xmstoolkit.

You might also like