SMPPCOM.cpp
资源名称:smpplib.zip [点击查看]
上传用户:hkcoast
上传日期:2007-01-12
资源大小:979k
文件大小:2k
源码类别:
手机短信编程
开发平台:
Visual C++
- // 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;
- }