Click here to Skip to main content
15,897,519 members
Articles / Programming Languages / C++

ToDoList Add-on

Rate me:
Please Sign up or sign in to vote.
4.69/5 (6 votes)
20 Apr 2002CPOL3 min read 242.6K   2.9K   57  
A Visual Studio add-in to help navigate to TODO:, TASK: etc comments, as well as showing STL containers in debug mode such as std::string, std::list etc
/********************************************************************\
	created:		2001/04/07
	created:		7:4:2001   20:38
	filename: 	todocached.cpp
	file path:	no matter
	file base:	todocached
	file ext:		cpp
	author:			Alex Kucherenko
	
	purpose:	
\********************************************************************/

#include "stdafx.h"
#include <initguid.h>
#include "ToDoCached.h"
#include "DSAddIn.h"
#include "Commands.h"

#ifdef _DEBUG
  #define new DEBUG_NEW
  #undef THIS_FILE
  static char THIS_FILE[] = __FILE__;
#endif

CComModule _Module;

BEGIN_OBJECT_MAP(ObjectMap)
	OBJECT_ENTRY(CLSID_DSAddIn, CDSAddIn)
END_OBJECT_MAP()

/////////////////////////////////////////////////////////////////////////////
// CToDoCachedApp

class CToDoCachedApp : public CWinApp
{
  public:
	  CToDoCachedApp();

	  //{{AFX_VIRTUAL(CToDoCachedApp)
	  public:
	  virtual BOOL InitInstance();
	  virtual int ExitInstance();
	  //}}AFX_VIRTUAL

	  //{{AFX_MSG(CToDoCachedApp)
	  //}}AFX_MSG
	  DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
// CToDoCachedApp

BEGIN_MESSAGE_MAP(CToDoCachedApp, CWinApp)
	//{{AFX_MSG_MAP(CToDoCachedApp)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// The one and only CToDoCachedApp object

CToDoCachedApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CToDoCachedApp construction

CToDoCachedApp::CToDoCachedApp()
{
}

/////////////////////////////////////////////////////////////////////////////
// CToDoCachedApp initialization

BOOL CToDoCachedApp::InitInstance()
{
	_Module.Init(ObjectMap, m_hInstance);
	return CWinApp::InitInstance();
}

//////////////////////////////////////////////////////////////////////////
//  

int CToDoCachedApp::ExitInstance()
{
	_Module.Term();
	return CWinApp::ExitInstance();
}

/////////////////////////////////////////////////////////////////////////////
// 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;

	_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_TODOCACHED_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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO ArtfulBits Inc.
Ukraine Ukraine
Name:Kucherenko Oleksandr

Born:September 20, 1979

Platforms: Win32, Linux; - well known and MS-DOS; Win16; OS/2 - old time not touched;

Hardware: IBM PC

Programming Languages: Assembler (for Intel 80386); Borland C/C++; Borland Pascal; Object Pascal; Borland C++Builder; Delphi; Perl; Java; Visual C++; Visual J++; UML; XML/XSL; C#; VB.NET; T-SQL; PL/SQL; and etc.

Development Environments: MS Visual Studio 2001-2008; MS Visual C++; Borland Delphi; Borland C++Builder; C/C++ any; Rational Rose; GDPro; Together and etc.

Libraries: STL, ATL, WTL, MFC, NuMega Driver Works, VCL; .NET 1.0, 1.1, 2.0, 3.5; and etc.

Technologies: Client/Server; COM; DirectX; DirectX Media; BDE; HTML/DHTML; ActiveX; Java Servlets; DCOM; COM+; ADO; CORBA; .NET; Windows Forms; GDI/GDI+; and etc.

Application Skills: Databases - design and maintain, support, programming; GUI Design; System Programming, Security; Business Software Development. Win/Web Services development and etc.

Comments and Discussions