📄 resorgaddin.cpp
字号:
// ResOrgAddIn.cpp : COM support routines
//
#include "StdAfx.h"
#include "DSAddIn.h"
#include "Commands.h"
#include "ResOrgAddIn.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Special entry points required for inproc servers
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return _Module.GetClassObject(rclsid, riid, ppv);
}
STDAPI DllCanUnloadNow(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
// by exporting DllRegisterServer, you can use regsvr32.exe
STDAPI DllRegisterServer(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT hRes = S_OK;
// Registers object, typelib and all interfaces in typelib
hRes = _Module.RegisterServer(TRUE);
if (FAILED(hRes))
return hRes;
// Register description of this add-in object in its own
// "/Description" subkey.
// TODO: If you add more add-ins to this module, you need
// to register all of their descriptions, each description
// in each add-in object's registry CLSID entry:
// HKEY_CLASSES_ROOT\Clsid\{add-in CLSID}\Description="add-in description"
_ATL_OBJMAP_ENTRY* pEntry = _Module.m_pObjMap;
CRegKey key;
LONG lRes = key.Open(HKEY_CLASSES_ROOT, _T("CLSID"));
if (lRes == ERROR_SUCCESS)
{
USES_CONVERSION;
LPOLESTR lpOleStr;
StringFromCLSID(*pEntry->pclsid, &lpOleStr);
LPTSTR lpsz = OLE2T(lpOleStr);
lRes = key.Open(key, lpsz);
if (lRes == ERROR_SUCCESS)
{
CString strDescription;
strDescription.LoadString(IDS_RESORG_DESCRIPTION);
key.SetKeyValue(_T("Description"), strDescription);
}
CoTaskMemFree(lpOleStr);
}
if (lRes != ERROR_SUCCESS)
hRes = HRESULT_FROM_WIN32(lRes);
return hRes;
}
/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT hRes = S_OK;
_Module.UnregisterServer();
return hRes;
}
/////////////////////////////////////////////////////////////////////////////
// Debugging support
// GetLastErrorDescription is used in the implementation of the VERIFY_OK
// macro, defined in stdafx.h.
#ifdef _DEBUG
void GetLastErrorDescription(CComBSTR& bstr)
{
CComPtr<IErrorInfo> pErrorInfo;
if (GetErrorInfo(0, &pErrorInfo) == S_OK)
pErrorInfo->GetDescription(&bstr);
}
#endif //_DEBUG
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -