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

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

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

Dim objMm7Protocol As AXmsCtrl.MmsProtocolMm7
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 MMS objects in the following way:

Set objMm7Protocol = CreateObject("ActiveXperts.MmsProtocolMm7")
Set objMmsConstants = CreateObject("ActiveXperts.MmsConstants")
Set objMmsMessage = CreateObject("ActiveXperts.MmsMessage")
Set objMmsSlide = CreateObject("ActiveXperts.MmsSlide") 

Step 5: Send MMS messages

The following code shows how to send MMS messages:

Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Const MAX_PATH = 260

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

Dim objMm7Protocol As AXmsCtrl.MmsProtocolMm7
Dim objMmsConstants As AXmsCtrl.MmsConstants
Dim objMmsSlide As AXmsCtrl.MmsSlide
Dim objMmsMessage As AXmsCtrl.MmsMessage

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

Private Sub CheckAuthentication_Click()
    EnableControls
End Sub

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

Private Sub CommandBrowse_Click()
    CommonDialog1.DefaultExt = "GetAdsiDatabase"
    CommonDialog1.DialogTitle = "Select Attachment"
    CommonDialog1.Filter = "All Files (GetAdsiDatabase)|GetAdsiDatabase"
    CommonDialog1.ShowOpen
    
    TextImage.Text = CommonDialog1.FileName
End Sub

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

Private Sub CommandSend_Click()
    MousePointer = vbHourglass
    CommandSend.Enabled = False
           
    ' Server Properties
    objMm7Protocol.ProviderHost = TextServer.Text
    
    If (CheckAuthentication.Value = True) Then
        objMm7Protocol.ProviderAccount = TextAccount.Text
        objMm7Protocol.ProviderPassword = TextPassword.Text
    Else
        objMm7Protocol.ProviderAccount = ""
        objMm7Protocol.ProviderPassword = ""
    End If
    
    objMm7Protocol.ProviderUseSSL = CheckSSL.Value
    
    ' MM7 Specific settings
    objMm7Protocol.ProviderMM7Schema = ComboScheme.ListIndex
    objMm7Protocol.ProviderMM7Variation = ComboVariation.ListIndex
    objMm7Protocol.ProviderMM7Version = ComboVersion.ListIndex
        
    ' Logfile
    objMm7Protocol.LogFile = TextLogfile.Text
    
    'Message Properties
    objMmsMessage.AddRecipient TextTo.Text
    objMmsMessage.Subject = TextSubject.Text
    
    objMmsSlide.Duration = 5
    objMmsSlide.AddAttachment TextImage.Text
    objMmsSlide.AddText TextBody.Text
    
    objMmsMessage.AddSlide objMmsSlide
    
    objMm7Protocol.Send objMmsMessage
    
    TextResult.Text = "ERROR #" & objMm7Protocol.LastError & " : " & objMm7Protocol.GetErrorDescription(objMm7Protocol.LastError)
    TextResponse.Text = objMm7Protocol.ProviderResponse
       
    CommandSend.Enabled = True
    MousePointer = vbDefault
End Sub

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

Private Sub CommandView_Click()
    If FileExists(TextLogfile.Text) = True Then
    Shell "notepad " + TextLogfile.Text, vbNormalFocus
    End If
End Sub

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

Private Sub Form_Load()
    Set objMm7Protocol = CreateObject("ActiveXperts.MmsProtocolMm7")
    Set objMmsConstants = CreateObject("ActiveXperts.MmsConstants")
    Set objMmsMessage = CreateObject("ActiveXperts.MmsMessage")
    Set objMmsSlide = CreateObject("ActiveXperts.MmsSlide")
    
    ComboVersion.AddItem ("5.2.0")
    ComboVersion.AddItem ("5.3.0")
    ComboVersion.AddItem ("5.4.0")
    ComboVersion.AddItem ("5.5.0")
    ComboVersion.AddItem ("5.6.0")
    ComboVersion.AddItem ("5.7.0")
    ComboVersion.AddItem ("5.8.0")
    ComboVersion.AddItem ("5.9.0")
    ComboVersion.AddItem ("5.10.0")
    ComboVersion.AddItem ("5.11.0")
    ComboVersion.AddItem ("6.0.0")
    ComboVersion.AddItem ("6.1.0")
    ComboVersion.AddItem ("6.2.0")
    ComboVersion.AddItem ("6.3.0")
    ComboVersion.AddItem ("6.4.0")
    ComboVersion.AddItem ("6.5.0")
    ComboVersion.AddItem ("6.6.0")
    ComboVersion.AddItem ("6.7.0")
    
    ComboVersion.ListIndex = 0
    
    ComboScheme.AddItem ("REL-5-MM7-1-0")
    ComboScheme.AddItem ("REL-5-MM7-1-1")
    ComboScheme.AddItem ("REL-5-MM7-1-2")
    ComboScheme.AddItem ("REL-5-MM7-1-3")
    ComboScheme.AddItem ("REL-5-MM7-1-4")
    ComboScheme.AddItem ("REL-5-MM7-1-5")
    ComboScheme.AddItem ("REL-5-MM7-1-0")
    ComboScheme.AddItem ("REL-6-MM7-1-1")
    ComboScheme.AddItem ("REL-6-MM7-1-2")
    ComboScheme.AddItem ("REL-6-MM7-1-3")

    ComboScheme.ListIndex = 0
    
    ComboVariation.AddItem ("3GPP")
    ComboVariation.AddItem ("Ericsson")
    ComboVariation.AddItem ("PAP")
    
    ComboVariation.ListIndex = 0
       
    EnableControls
    
    SetDefaultLogFile
End Sub

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

Public Function FileExists(sFileName As String) As Boolean
  FileExists = CBool(Len(Dir$(sFileName))) And CBool(Len(sFileName))
End Function

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

Private Function SetDefaultLogFile()

Dim Buffer As String
Buffer = Space(MAX_PATH)

If GetTempPath(MAX_PATH, Buffer) <> 0 Then
    TextLogfile.Text = Left$(Buffer, InStr(Buffer, vbNullChar) - 1) & "MM7Log.txt"
Else
    TextLogfile.Text = "C:\MM7Log.txt"
End If
End Function

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

Private Sub EnableControls()
    TextAccount.Enabled = CheckAuthentication.Value
    TextPassword.Enabled = CheckAuthentication.Value
    LabelAccount.Enabled = CheckAuthentication.Value
    LabelPassword.Enabled = CheckAuthentication.Value
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.