📄 warserversnapin.cpp
字号:
// WarServerSnapin.cpp : Implementation of DLL Exports.// Note: Proxy/Stub Information// To build a separate proxy/stub DLL, // run nmake -f WarServerSnapinps.mk in the project directory.#include "stdafx.h"#include "resource.h"#include <initguid.h>#include "WarServerSnapin.h"#include "WarServerSnapin_i.c"#include "WarSvrSnapin.h"CComModule _Module;BEGIN_OBJECT_MAP(ObjectMap)OBJECT_ENTRY(CLSID_WarSvrSnapin, CWarSvrSnapin)OBJECT_ENTRY(CLSID_WarSvrSnapinAbout, CWarSvrSnapinAbout)END_OBJECT_MAP()class CWarServerSnapinApp : public CWinApp{public: CWarServerSnapinApp() : mp_WarOs(NULL) {}// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CWarServerSnapinApp) public: virtual BOOL InitInstance(); virtual int ExitInstance(); //}}AFX_VIRTUAL //{{AFX_MSG(CWarServerSnapinApp) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() WarOs *mp_WarOs; WarLogEngine *mp_LogEngine;};BEGIN_MESSAGE_MAP(CWarServerSnapinApp, CWinApp) //{{AFX_MSG_MAP(CWarServerSnapinApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAPEND_MESSAGE_MAP()CWarServerSnapinApp theApp;BOOL CWarServerSnapinApp::InitInstance(){ _Module.Init(ObjectMap, m_hInstance, &LIBID_WARSERVERSNAPINLib); // Initialize WarLib WarSmartPointer::Initialize(); mp_WarOs = new WarOs; mp_LogEngine = new WarLogEngine; // Setup the registry path WarWin32Registry::mRootPath << "SOFTWARE" << WAR_SYSSLASH << VENDOR << WAR_SYSSLASH << WAR_DEBUG_PREFIX _T("Servers"); return CWinApp::InitInstance();}int CWarServerSnapinApp::ExitInstance(){ _Module.Term(); if (mp_WarOs) { delete mp_WarOs; mp_WarOs = NULL; } return CWinApp::ExitInstance();}/////////////////////////////////////////////////////////////////////////////// Used to determine whether the DLL can be unloaded by OLESTDAPI DllCanUnloadNow(void){ AFX_MANAGE_STATE(AfxGetStaticModuleState()); return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;}/////////////////////////////////////////////////////////////////////////////// Returns a class factory to create an object of the requested typeSTDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv){ return _Module.GetClassObject(rclsid, riid, ppv);}/////////////////////////////////////////////////////////////////////////////// DllRegisterServer - Adds entries to the system registrySTDAPI DllRegisterServer(void){ // registers object, typelib and all interfaces in typelib return _Module.RegisterServer(TRUE);}/////////////////////////////////////////////////////////////////////////////// DllUnregisterServer - Removes entries from the system registrySTDAPI DllUnregisterServer(void){ return _Module.UnregisterServer(TRUE);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -