Click here to Skip to main content
15,896,111 members
Articles / Desktop Programming / MFC

An SMPPLIB with COM Support

Rate me:
Please Sign up or sign in to vote.
4.94/5 (25 votes)
27 Oct 20039 min read 333.7K   5.5K   87  
It is an SMPP implementation of v3.3 and v3.4 ( partial support). You can use it to connect to SMSC and send/receive SMS.
// SmppAddressCom.cpp : Implementation of CSmppAddressCom

#include "stdafx.h"
#include "SmppAddressCom.h"


// CSmppAddressCom


STDMETHODIMP CSmppAddressCom::get_TON(SHORT* pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// TODO: Add your implementation code here
	*pVal = m_addr_ton;

	return S_OK;
}

STDMETHODIMP CSmppAddressCom::put_TON(SHORT newVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// TODO: Add your implementation code here
	m_addr_ton = newVal;

	return S_OK;
}

STDMETHODIMP CSmppAddressCom::get_NPI(SHORT* pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// TODO: Add your implementation code here
	*pVal = m_addr_npi;

	return S_OK;
}

STDMETHODIMP CSmppAddressCom::put_NPI(SHORT newVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// TODO: Add your implementation code here
	m_addr_npi = newVal;

	return S_OK;
}

STDMETHODIMP CSmppAddressCom::get_Address(BSTR* pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// TODO: Add your implementation code here
   try
   {
		*pVal = m_addr.AllocSysString();
   }
   catch (...)
   {
	   return E_OUTOFMEMORY;
   }


	return S_OK;
}

STDMETHODIMP CSmppAddressCom::put_Address(BSTR newVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// TODO: Add your implementation code here

	USES_CONVERSION;

	LPSTR paddr = OLE2A(newVal);

	m_addr = paddr;

	return S_OK;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Hong Kong Hong Kong
I'm a guy situated in Hong Kong with some knowledges in Java, VC++, C#, database, client-server, distributed, and mutithreaded computing and so on. I've been working in various companies as engineer, consultant, programmer.

Lately I was mainly working in banking & financial industries. Personally, I'm working on a trading application on my own now.

Comments and Discussions