|
// SMPPCOM.cpp : Implementation of DLL Exports.
#include "stdafx.h"
#include "resource.h"
#include "SMPPCOM.h"
#include "dlldatax.h"
class CSMPPCOMModule : public CAtlDllModuleT< CSMPPCOMModule >
{
public :
DECLARE_LIBID(LIBID_SMPPCOMLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_SMPPCOM, "{31C91F31-DF1B-4A6A-8FAA-B316F08BDD04}")
};
CSMPPCOMModule _AtlModule;
class CSMPPCOMApp : public CWinApp
{
public:
// Overrides
virtual BOOL InitInstance();
virtual int ExitInstance();
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CSMPPCOMApp, CWinApp)
END_MESSAGE_MAP()
CSMPPCOMApp theApp;
BOOL CSMPPCOMApp::InitInstance()
{
#ifdef _MERGE_PROXYSTUB
if (!PrxDllMain(m_hInstance, DLL_PROCESS_ATTACH, NULL))
return FALSE;
#endif
WSADATA wsaData;
WSAStartup(MAKEWORD(2,2), &wsaData);
return CWinApp::InitInstance();
}
int CSMPPCOMApp::ExitInstance()
{
WSACleanup();
return CWinApp::ExitInstance();
}
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
#ifdef _MERGE_PROXYSTUB
HRESULT hr = PrxDllCanUnloadNow();
if (FAILED(hr))
return hr;
#endif
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return (AfxDllCanUnloadNow()==S_OK && _AtlModule.GetLockCount()==0) ? S_OK : S_FALSE;
}
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
#ifdef _MERGE_PROXYSTUB
if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
return S_OK;
#endif
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
HRESULT hr = _AtlModule.DllRegisterServer();
#ifdef _MERGE_PROXYSTUB
if (FAILED(hr))
return hr;
hr = PrxDllRegisterServer();
#endif
return hr;
}
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
HRESULT hr = _AtlModule.DllUnregisterServer();
#ifdef _MERGE_PROXYSTUB
if (FAILED(hr))
return hr;
hr = PrxDllRegisterServer();
if (FAILED(hr))
return hr;
hr = PrxDllUnregisterServer();
#endif
return hr;
}
|
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.
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
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.