ActiveXperts
SMS & MMS Toolkit


 Product Overview

 Supported Protocols:
 
 How to use

 Online Samples

 Download (.exe)

 Brochure (.pdf)

 Manual (.htm)

 Release Notes


Support

 Knowledge Base

 Forum

 Contact Support


Purchase

 Licensing

 Pricing

 Order now


Providers

 SMPP Providers

 MMS Providers

 TAP/UCP Providers

 SNPP Providers


Related documents

 Case studies

 SMS Documents

 GSM Network Codes

 TAPI Documents

 About Mobile
 Communications


 AT Commands

 RFC's


  Download ActiveXperts SMS and MMS Toolkit 5.0  (6754 KB - .exe file)
  Download Manual  (623 KB - .htm file)


Using SMS and MMS Toolkit with ASP.NET Visual Basic (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.
An 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.
An 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 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 ASP.NET projects.


Prerequisites

You must install and configre Internet Information Services (IIS) before using the SMS and MMS Toolkit with ASP .NET
If you don't have IIS installed, use the following steps:
  • From the Control Panel, click 'Add/Remove Programs'. Select the 'Add/Remove Windows Components' icon from the left pane, then select 'Application Server' and click on 'Details'. You can now select both 'ASP .NET' and 'Internet Information Services (IIS)'. Click 'OK' to continue installation;
  • Make sure that ASP .NET is allowed on the web server:


    (Click on the picture to enlarge)



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 ASP .NET VB Project

Launch Microsoft Visual Studio (for instance 'Microsoft Visual Studio 2005') from the Start menu. Choose 'New' from the 'File' menu and click on 'Web Site'. In the 'Web Site' dialog, select ASP .NET Web Site. Select a name for the application (for instance: 'DemoApp') and a name for the solution (for instance: 'DemoSolution'). Also, select the directory where you want to store the project (for instance: 'C:\MyProjects):

    
    (Click on the picture to enlarge)



Step 3: Refer to the SMS and MMS Toolkit Library

Now that a new project has been created, you must add a reference to the SMS and MMS Toolkit in the project to be able to use the SMS and MMS Toolkit objects. To do so, choose 'Add Reference...' from the 'Project' menu. In the 'Add Reference' dialog that pops up, select the 'COM' tab and select the 'ActiveXperts SMS and MMS Toolkit Type Library' as shown in the following picture:

    
    (Click on the picture to enlarge)

Click 'OK' to close the 'Add Reference' dialog.
On top of your code, type the following line to use the SMS and MMS Toolkit namespace:
   Imports AXmsCtrl



Step 4: Declare and create the MMS objects

In your Main function, declare and create the following objects:
   Dim objMmsProtocolMm1 As MmsProtocolMm1
   Dim objMmsMessage     As MmsMessage
   Dim objMmsSlide       As MmsSlide
   Dim objMmsConstants   As MmsConstants
      
   objMmsProtocolMm1   = New MmsProtocolMm1 ()
   objMmsMessage       = new MmsMessage ()
   objMmsSlide         = new MmsSlide ()
   objMmsConstants     = new MmsConstants ()


Step 5: Send MMS messages

You can now send MMS messages.

The following code shows how to send a MMS message:
Public Class WebForm1
    Inherits System.Web.UI.Page
    Protected WithEvents Table1 As System.Web.UI.WebControls.Table
    Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
    Protected WithEvents Form2 As System.Web.UI.HtmlControls.HtmlForm
    Protected WithEvents cbCountries As System.Web.UI.WebControls.DropDownList
    Protected WithEvents btnSend As System.Web.UI.WebControls.Button
    Protected WithEvents cbProviders As System.Web.UI.WebControls.DropDownList
    Protected WithEvents txtMessage As System.Web.UI.WebControls.TextBox
    Protected WithEvents cbDevices As System.Web.UI.WebControls.DropDownList
    Protected WithEvents txtPin As System.Web.UI.WebControls.TextBox
    Protected WithEvents cbImage As System.Web.UI.WebControls.DropDownList
    Protected WithEvents txtResults As System.Web.UI.WebControls.TextBox

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    'Declare the objects
    Public objMm1Protocol As MmsProtocolMm1
    Public objMmsSlide    As MmsSlide
    Public objMmsMessage  As MmsMessage

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Create the objects
        objMm1Protocol = New MmsProtocolMm1()
        objMmsSlide    = New MmsSlide()
        objMmsMessage  = New MmsMessage()

        Dim intDevices, i As Int32
        intDevices = objMm1Protocol.GetDeviceCount()
        cbDevices.Items.Clear()

        For i = 0 To intDevices - 1
            cbDevices.Items.Insert(i, objMm1Protocol.GetDevice(i))
        Next

        ListCountries()
        ListProviders()
    End Sub

    Function GetInstallDir()
        'List all countries and read the register
        Dim objWshShell As IWshRuntimeLibrary.WshShell
        Dim strInstallDir, strMMCSDir, strRegKeyDir
        objWshShell = New IWshRuntimeLibrary.WshShell()

        'Find out where the toolkit is installed and where the mm1 files are
        strRegKeyDir = "HKEY_LOCAL_MACHINE\SOFTWARE\ActiveXperts\SMS and MMS Toolkit\InstallRoot"
        strMMCSDir = "\Providers\Mms\Mm1"
        strInstallDir = objWshShell.RegRead(strRegKeyDir)
        strInstallDir = strInstallDir & strMMCSDir

        GetInstallDir = strInstallDir
    End Function

    Private Sub ListCountries()

        Dim strInstallDir As String
        strInstallDir = GetInstallDir()

        'Get all folders in the mm1 folder
        Dim arrFolders As Array
        Dim intLength, i As Int32
        arrFolders = System.IO.Directory.GetDirectories(strInstallDir)
        intLength = System.IO.Directory.GetDirectories(strInstallDir).Length

        'Empty the countries dropdown box
        cbCountries.Items.Clear()

        'Display all countries in the dropdown box
        Do While i < intLength
            Dim strFolder As String
            strFolder = arrFolders(i)
            strFolder = Replace(strFolder, strInstallDir, "")
            strFolder = Replace(strFolder, "\", "")
            cbCountries.Items.Insert(i, strFolder)
            i = i + 1
        Loop

        Dim strSelectedCountry As String
        strSelectedCountry = Request("cbCountries")
        If strSelectedCountry <> "" Then
            cbCountries.Items.FindByValue(strSelectedCountry).Selected = True
        End If
    End Sub

    Private Sub ListProviders()
        If Request("cbCountries") <> "" Then
            Dim strMM1Location As String
            Dim arrFiles As Array
            Dim intLength As Int32
            strMM1Location = GetInstallDir() & "\" & Request("cbCountries")
            arrFiles = System.IO.Directory.GetFiles(strMM1Location)
            intLength = System.IO.Directory.GetFiles(strMM1Location).Length

            cbProviders.Items.Clear()

            Dim i As Int32
            i = 0
            cbProviders.Items.Clear()

            For i = 0 To intLength - 1
                Dim strProviderName
                strProviderName = arrFiles(i)
                strProviderName = Replace(strProviderName, GetInstallDir(), "")
                strProviderName = Replace(strProviderName, "\" & cbCountries.SelectedItem.Value & "\", "")
                strProviderName = Replace(strProviderName, ".mm1", "")
                cbProviders.Items.Insert(i, strProviderName)
            Next

            Dim strSelectedProvider As String
            strSelectedProvider = Request("cbProviders")
            If strSelectedProvider <> "" Then
                On Error Resume Next
                Dim objSelectedItem As Object
                objSelectedItem = cbProviders.Items.FindByValue(strSelectedProvider).Value
                If Err.Number = 0 Then
                    cbProviders.Items.FindByValue(strSelectedProvider).Selected = True
                End If
                On Error GoTo 0
            End If
        End If

    End Sub

    Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
        objMmsMessage.Clear()
        objMmsMessage.Subject = Request("txtSubject")
        objMmsMessage.From = Request("txtFrom")
        objMmsMessage.AddRecipient(Request("txtTo"))

        If objMm1Protocol.LastError = 0 Then
            Dim strImg As String
            strImg = "img" & cbImage.SelectedItem.Value & ".gif"
            strImg = Server.MapPath(strImg)

            objMmsSlide.Clear()
            objMmsSlide.Duration = 10
            objMmsSlide.AddText(txtMessage.Text)
            objMmsSlide.AddAttachment(strImg)
        End If

        If objMm1Protocol.LastError = 0 Then
            objMmsMessage.AddSlide(objMmsSlide)
        End If

        If objMm1Protocol.LastError = 0 Then
            objMm1Protocol.Device = cbDevices.SelectedItem.Value
            objMm1Protocol.EnterPin(txtPin.Text)
        End If

        If objMm1Protocol.LastError = 0 Then
            Dim strMm1ConfFile As String
            strMm1ConfFile = GetInstallDir() & "\" & Request("cbCountries") & "\" & Request("cbProviders") & ".mm1"
            objMm1Protocol.ProviderLoadConfig(strMm1ConfFile)
            objMm1Protocol.Connect()
        End If

        If objMm1Protocol.LastError = 0 Then
            objMm1Protocol.Send(objMmsMessage)
            objMm1Protocol.Disconnect()
        End If

        txtResults.Text = objMm1Protocol.GetErrorDescription(objMm1Protocol.LastError)
    End Sub
End Class

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


NOTE: Demo Projects are created with Microsoft Visual Studio 2003

The MMS Toolkit project ships with a set of Microsoft Visual Studio .NET samples, including samples for ASP.NET. The projects are created with Microsoft Visual Studio 2003.
Users with a later version of Microsoft Visual Studio can open such a project. The Visual Studio Conversion Wizard will guide you through the process of converting the project to the version used.





The ActiveXperts SMS and MMS Toolkit is a SMS development component (SDK). This control can be used by any Windows development platform, including Visual Basic .NET, Visual CSharp .NET, ASP .NET (VB,CS), ASP, Visual Basic, Visual Basic for Applications (VBA), Visual Studio/Visual C++, Borland Delphi and C++ Builder, PHP, ColdFusion, HTML, VBScript and any other ActiveX/COM compliant platform. The SMS and MMS Toolkit is an ActiveXperts Software B.V. Product.

Copyright ©1999-2007 ActiveXperts Software. All rights reserved.