ActiveXperts SMS and MMS Toolkit Add SMS and MMS capabilities to any Windows or .NET application

Using SMS and MMS Toolkit with Visual Basic 5.x/6.x (MM1 Connection)

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 fixed-line 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, Hebrew, 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, Windows Powershell 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 projects.

Step 1: Download and install the SMS and MMS Toolkit

Download the 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':

Visual Basic

(Click on the picture to enlarge)

Step 3: Refer to the SMS and MMS Toolkit Library and create the objects

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 MMS 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:

Visual Basic

(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:

Visual Basic

(Click on the picture to enlarge)

On top of your code, declare the following objects for GSM:

Dim objMm1Protocol As AXmsCtrl.MmsProtocolMm1
Dim objMmsConstants As AXmsCtrl.MmsConstants
Dim objMmsSlide As AXmsCtrl.MmsSlide
Dim objMmsMessage As AXmsCtrl.MmsMessage

Step 4: 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 objMm1Protocol = CreateObject("ActiveXperts.MmsProtocolMm1")
Set objMmsConstants = CreateObject("ActiveXperts.MmsConstants")

The 'MmsMessage' and 'MmsSlide' objects aren't created as this point, as they will returned by the 'MmsProtocolMm1' object while retrieving the MMS messages.

Step 5: Receive MMS messages

The following code shows how to receive MMS messages:

Option Explicit

'/////////////////////////////////////////////////////////////////////////////////////////////////////////

Public objConnection As AXmsCtrl.MmsProtocolMm1
Public objConstants As AXmsCtrl.MmsConstants

'/////////////////////////////////////////////////////////////////////////////////////////////////////////

Private Sub CommandReceive_Click()
    Dim objMessage As MmsMessage
    Dim objSlide As MmsSlide
    
    Dim numMessages As Integer
    Dim numAttachments As Integer
    
    Dim i As Integer
    Dim j As Integer
    
    ' Device Properties
    objConnection.Device = ComboDevice.Text
    
    ' Server Properties
    objConnection.ProviderMMSC = TextMmscServer.Text
    objConnection.ProviderAPN = TextAPN.Text
    objConnection.ProviderWAPGateway = TextWapGateway.Text
    objConnection.ProviderAPNAccount = TextAPNAccount.Text
    objConnection.ProviderAPNPassword = TextAPNPassword.Text
    
    ' Logfile
    objConnection.LogFile = TextLogfile.Text
    
    ' Check for new MMS notifications
    numMessages = objConnection.CountReceivedMessages

    If (numMessages <> 0) Then
        objConnection.Connect
        
        If (GetResult() <> 0) Then
            Exit Sub
        End If
        
        For i = 0 To numMessages - 1
            Set objMessage = objConnection.GetMessage(i)
            
            If (GetResult() <> 0) Then
                               
                Set objSlide = objMessage.GetFirstSlide
            
                While (GetResult() <> 0)
                    TextReceived.Text = TextReceived.Text & "New message received from : " & objMessage.From
                    TextReceived.Text = TextReceived.Text & "Subject                   : " & objMessage.Subject
                    
                    numAttachments = objSlide.CountAttachments
                    
                    For j = 0 To numAttachments - 1
                        TextReceived.Text = TextReceived.Text & objSlide.GetAttachmentName(j)
                    Next
                    
                    Set objSlide = objMessage.GetNextSlide
                Wend
            End If
        Next
        
        objConnection.Disconnect
              
    End If
    
End Sub

'/////////////////////////////////////////////////////////////////////////////////////////////////////////

Private Function GetResult()
    Dim lError As Long
    
    lError = objConnection.LastError
    
    TextResult.Text = lError & " (" & objConnection.GetErrorDescription(lError) & ")"
    
    GetResult = lError
End Function

'/////////////////////////////////////////////////////////////////////////////////////////////////////////

Private Sub Form_Load()
    Dim numDevices
    Dim i

    Set objConnection = CreateObject("ActiveXperts.MmsProtocolMm1")
    Set objConstants = CreateObject("ActiveXperts.MmsConstants")
    
    numDevices = objConnection.GetDeviceCount
    
    For i = 0 To numDevices - 1
        ComboDevice.AddItem (objConnection.GetDevice(i))
        ComboDevice.ListIndex = 0
    Next
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/mobile-messaging-component.