Shortcut Menu

Skip

Main Navigation

Choose your language


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

Using The SMS and MMS Toolkit with Borland C++ Builder

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 Borland C++ Buider 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 C++ Builder Project

Launch Borland C++ Builder (for instance 'Borland C++ Builder 6') from the Start menu. Choose 'New' from the 'File' menu and select 'Application'. A new Form is displayed in the workspace.

CPP builder

(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 SMS and MMS Toolkit in the project to be able to use the SMS and MMS Toolkit object. To do so, choose 'Import Type Library...' from the 'Project' menu. The Import Type Library' dialog appears.

Borland CPP builder

(Click on the picture to enlarge)

In the upper selection box, select 'SMS and MMS Toolkit Type Library' and click 'Create Unit':

The interface code is generated now and is shown in the AXmsCtrl_TLB.cpp and AXmsCtrl_TLB.h tab of the project.

Step 4: Declare and create the objects

From the Project Manager, open Unit1.h and add include the AXmsCtrl_TLB.h file to refer to the SMS and MMS Toolkit library:

Borland C plus plus

(Click on the picture to enlarge)

In the 'private' or 'public' section, declare the following objects:

TCOMISmsProtocolGsm   m_objGsmProtocol;
TCOMISmsMessage       m_objSmsMessage;

You can now create the objects, for instance in the 'FormCreate' event handler or the class constructor:

m_objGsmProtocol     = CoSmsProtocolGsm::Create ();
m_objSmsMessage      = CoSmsMessage::Create ();

Step 5: Send SMS messages

You can now send SMS messages.

The following code shows how to send an SMS message unsing a connected GSM phone or modem:

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
    m_objGsmProtocol = CoSmsProtocolGsm::Create ();
    m_objSmsMessage = CoSmsMessage::Create ();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)
{
    LONG lDevices = m_objGsmProtocol->GetDeviceCount();

    for ( LONG l = 0 ; l < lDevices ; l++ )
    {
        ComboBoxDevice->Items->Add ( m_objGsmProtocol->GetDevice(l) );
    }

    ComboBoxDevice->Items->Add ( "COM1" );
    ComboBoxDevice->Items->Add ( "COM2" );
    ComboBoxDevice->Items->Add ( "COM3" );
    ComboBoxDevice->Items->Add ( "COM4" );
    ComboBoxDevice->Items->Add ( "COM5" );
    ComboBoxDevice->Items->Add ( "COM6" );
    ComboBoxDevice->Items->Add ( "COM7" );
    ComboBoxDevice->Items->Add ( "COM8" );

    ComboBoxDevice->ItemIndex = 0;
    ComboBoxSpeed->ItemIndex  = 7;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ButtonSendClick(TObject *Sender)
{
   ButtonSend->Enabled = FALSE;
   Cursor = crHourGlass;

   m_objGsmProtocol->set_Device(WideString (ComboBoxDevice->Text) );
   m_objGsmProtocol->set_DeviceSpeed(ComboBoxSpeed->Text.ToInt());
   m_objSmsMessage->set_Data(WideString(MemoMessage->Text));
   m_objSmsMessage->set_Recipient(WideString(EditRecipient->Text));

   m_objGsmProtocol->Send( m_objSmsMessage );

   EditResult->Text = m_objGsmProtocol->GetErrorDescription(m_objGsmProtocol->get_LastError());

   Cursor = crDefault;
   ButtonSend->Enabled = TRUE;
}
//---------------------------------------------------------------------------

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.

NOTE: Demo Projects are created with Borland C++ Builder 6

The SMS and MMS Toolkit project ships with a set of samples for Borland C++ Builder. The projects are created with Borland C++ Builder 6.

Users with a later version of Borland C++ Builder 6 can open such a project. The Borland Conversion Wizard will guide you through the process of converting the project to the version used.