SMS
Messaging Server


 Product Overview

 Download (.exe)

 Brochure (.pdf)

 Online Manual

 Release Notes

 Case Studies


Support

 FAQ/KBase

 API Samples

 Forum

 Contact Support


Purchase

 Licensing Scheme

 Pricing

 Order now


Related documents

 SMPP Providers

 Cellular
 Communications


 SMS Glossary

 SMS Documents



  Download ActiveXperts SMS Messaging Server 5.0  (7560 KB - .exe file)
  Case studies - How SMS Messaging Server is used by existing customers


Send an SMS message using the SMS Messaging Server API - Visual C++ 5.x/6.x


SMS Messaging Server is a mobile messaging framework that enables companies to send, receive and process SMS- and e-mail messages. The framework is designed support virtually any scenario where low-and high volume SMS messaging is required. Use SMS Messaging Server in the following scenarios:
  • Mobile users query a database; results are sent back via SMS or e-mail;
  • Mobile users receive important information via SMS or e-mail while they are away from the office;
  • Stock prices are sent automatically via SMS and/or e-mail, daily;
  • Remote workers can update their worksheet from a remote location trough SMS;
  • ICT administrators restart/reboot servers and/or daemons from remote by SMS;
  • Setup an SMS voting system, supporting SMS and/or e-mail;
  • Etc.
SMS Messaging Server can be well integrated into Visual C++ environments.
This document describes how the SMS Messaging Server can be integrated into Visual C++ projects.


Step 1: Download and install SMS Messaging Server

Download ActiveXperts SMS Messaging Server from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.



Step 2: Create a new Visual C++ project

Launch 'Microsoft Visual C++' from the Start menu, and choose 'New' from the 'File Menu'. The 'New' dialog appears.
Select the type of project (for instance: 'Win32 Console Application'), enter a 'Project name' and select the 'Location':

    
    (Click on the picture to enlarge)

Select the kind of project, for instance a 'Hello, world!' application and click 'Finish':

    
    (Click on the picture to enlarge)



Step 3: Refer to the SMS Messaging Server API Library and declare the objects

A new Project is created now.

Before you can use the SMS Messaging Server API, you need to refer to the SMS Messaging Server API library. The actually reference files are shipped with the product and are located in the following directory:
    C:\Program Files\ActiveXperts\SMS Messaging Server\API Samples\Visual C++\Include
Add this path to your standard include directories (Tools->Options: Directories-tab). This directory includes the following files, necessary to link to the SMS Messaging Server API:
    AxMmCfg.h
    AxMmCfg_i.c
    AxSmsConstants.h
On top of your code, declare the following objects:
    IXMessageDB *pMessageDB = NULL;       // Reference to the Message Database
    IXMessage   *pMessage   = NULL;       // Reference to a single message


Step 4: Create the objects

You must initialize the COM library before they can call COM library functions (e.g. SMS Messaging Server API functions):
   CoInitialize( NULL );
Create a Message Database instance in the following way:
   CoCreateInstance (  CLSID_XMessageDB,  NULL, CLSCTX_INPROC_SERVER, IID_IXMessageDB,  (void**) &pMessageDB );
You should not create an instance of a Message yourself; it is returned by functions like Create, FindFirstMessage, FindNextMessage and Load.



Step 5: Send an SMS messages

You can now send an SMS message.

The following code shows how to send an SMS message:
#include <comdef.h>
#include <atlbase.h>
#include <windows.h>
#include <stdio.h>

#include "..\..\include\AxSmsConstants.h"
#include "..\..\include\AxMmCfg.h"
#include "..\..\include\AxMmCfg_i.c"

int main(int argc, char* argv[])
{
   IXMessageDB *pMessageDB  = NULL;
   IXMessage   *pMessage    = NULL;
   LONG        lLastError   = 0L;
   LONG        lID          = 0L;
   VARIANT     vtVar;
   HRESULT     hr           = S_OK;

   // Initialize COM
   CoInitialize( NULL );

   // Initialize Variant
   VariantInit( &vtVar );

   // Create a new Mesage Database instance
   hr = CoCreateInstance (  CLSID_XMessageDB,  NULL, CLSCTX_INPROC_SERVER, IID_IXMessageDB,  (void**) &pMessageDB  ) ;
   if( ! SUCCEEDED( hr ) )
   {
      pMessageDB = NULL;
      printf( "Unable to create instance of the object.\n" );
      goto _EndMain;
   }

   // Open the Message Database
   pMessageDB->Open();
   pMessageDB->get_LastError( &lLastError );
   printf( "Open, result: %ld\n", lLastError );
   if( lLastError != 0L )
      goto _EndMain;

   // Create new Message in the Message Database
   pMessageDB->Create( &vtVar );
   pMessageDB->get_LastError( &lLastError );
   printf( "Create, result: %ld\n", lLastError );
   if(	  lLastError != 0L 
       || vtVar.vt != ( VT_DISPATCH )
       || ( pMessage = ( IXMessage* ) vtVar.pdispVal ) == NULL )
   {
      printf( "Unable to create new message.\n" );
      goto _EndMain;
   }

   // Get the ID of the new Message
   pMessage->get_ID( &lID );
   printf( "ID of the new message: %ld\n", lID );

   // Modify the Message
   pMessage->put_Direction( MESSAGEDIRECTION_OUT );
   pMessage->put_Type( MESSAGETYPE_SMS );
   pMessage->put_Status( MESSAGESTATUS_PENDING );
   pMessage->put_ChannelID( 0L );
   pMessage->put_ScheduledTime( _bstr_t( "" ) );
   pMessage->put_Recipient( _bstr_t( "+31625044454" ) );
   pMessage->put_Body( _bstr_t( "SMS Messaging Server - VC++ Test SMS" ) );

   // Save the Message
   pMessageDB->Save( &vtVar );
   pMessageDB->get_LastError( &lLastError );
   printf( "Save, result: %ld\n", lLastError );
   if( lLastError != 0L )
     goto _EndMain;

_EndMain:

   if( pMessageDB != NULL )
   {
      pMessageDB->Close();	// Note: It's no problem to call Close when database is not opened
      printf( "Database closed.\n" );
      pMessageDB->Release();
   }

   // Clear Variant
   VariantClear( &vtVar );

   CoUninitialize();
   printf("Ready.\n");
   return 0;
}





ActiveXperts SMS Messaging Server is a messaging framework to send and receive email and SMS messages. Use the API to create new messages from various development platforms, including Visual Basic .NET, Visual CSharp .NET, ASP .NET (VB,CS), ASP, Visual Basic, Visual Studio/Visual C++, Delphi, PHP, HTML, VBScript and any other ActiveX/COM compliant platform. SMS Messaging Server is an ActiveXperts Software B.V. Product.

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