|
// 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
|
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.
I haven't always written software for a living. When I graduated from Surrey University in 1989, it was with an Electronic Engineering degree, but unfortunately that never really gave me the opportunity to do anything particularly interesting (with the possible exception of designing
Darth Vader's Codpiece * for the UK Army in 1990).
* Also known as the Standard Army Bootswitch. But that's another story...
Since the opportunity arose to lead a software team developing C++ software for
Avionic Test Systems in 1996, I've not looked back. More recently I've been involved in the development of subsea acoustic navigation systems, digital TV broadcast systems, port security/tracking systems, and most recently software development tools with my own company,
Riverblade Ltd.
One of my personal specialities is IDE plug-in development.
ResOrg was my first attempt at a plug-in, but my day to day work is with
Visual Lint, an interactive code analysis tool environment with works within the Visual Studio and Eclipse IDEs or on build servers.
I love lots of things, but particularly music, photography and anything connected with history or engineering. I
despise ignorant, intolerant and obstructive people - and it shows...I can be a bolshy cow if you wind me up the wrong way...
I'm currently based 15 minutes walk from the beach in Bournemouth on the south coast of England. Since I moved here I've grown to love the place - even if it is full of grockles in Summer!