Click here to Skip to main content
11,706,142 members (54,779 online)
Click here to Skip to main content
Add your own
alternative version

Resource ID Organiser Add-In for Visual C++ 5.0/6.0/.NET

, 10 Jan 2005 CPOL 356.3K 10.1K 199
An application/add-in to organise and renumber resource symbol IDs
resorg103.zip
ResOrg103.exe
resorg104.zip
ResOrg104.exe
resorgaddinsetup.zip
ResOrgAddInSetup.exe
resorgaddin_executables.zip
ResOrg.exe
BXFileDialog.dll
CJ609Lib.dll
NGLib103.dll
ResOrgAddIn.dll
ResOrgCore.dll
ResOrg.cnt
resorg.fts
ResOrg.hlp
resorgnetaddinsetup.zip
ResOrgNETAddInSetup.msi
resorgnetaddin_executables.zip
ResOrgNETAddInToolWindows.ocx
ResOrgNET.exe
CJ609LibVc7.dll
NGLib103Vc7.dll
ResOrgNETAddIn.dll
ResOrgNETCore.dll
ResOrg.cnt
resorg.fts
ResOrg.hlp
ReadMe.rtf
Licence.rtf
resorgnet_executables.zip
ResOrgNET_executables
CJ609LibVc7.dll
NGLib103Vc7.dll
QHTMLight.dll
ResOrg.cnt
resorg.fts
ResOrg.hlp
ResOrgNETAddIn.dll
ResOrgNETAddInToolWindows.ocx
ResOrgNETCore.dll
resorg_demo.zip
ResOrg103.exe
resorg_executables.zip
ResOrgAddIn.dll
BXFileDialog.dll
CJ609Lib.dll
ResOrg.exe
ResOrg.cnt
resorg.fts
ResOrg.hlp
ResOrgCore.dll
NGLib103.dll
resorg_src.zip
BXFileDialog
BXFileDialog.dsp
Lib
Release
Res
bitmap2.bmp
FileOpen.bmp
filesave.bmp
CJLibrary
CJLibrary
CJLibrary.def
CJLibrary.dsp
CJLibrary.dsw
CJLibrarydep.jpg
CJLibraryStatic.dsp
Debug_Unicode
Release
Release_Unicode
res
Include
res
btn_arro.bmp
btn_explorer.bmp
button_images.bmp
cj_logo.bmp
dragging.cur
handcur.cur
headerba.bmp
hsplitba.cur
icr_hand.cur
nodraggi.cur
PushPin.bmp
Toolbar.bmp
vsplitba.cur
Lib
default.doxygen
NGLibrary
Bin
NGLibrary.def
NGLibrary.dsp
NGLibrary.dsw
Release
Res
Drives.bmp
Release
ResOrg.dsw
ResOrgAddIn
Release
Res
HtmlDoc.ico
ResOrg.ico
ResOrgDoc.ico
TBarLrge.bmp
TBarMedm.bmp
Toolbar.bmp
WorkspaceTabs.bmp
ResOrgAddIn.def
ResOrgAddIn.dsp
ResOrgAddIn.odl
ResOrgAddIn_Res.hm
ResOrgApp
Lint
Release
Res
HtmlDoc.ico
MAINFRAM.BMP
ResOrg.ico
ResOrgDoc.ico
TBarLrge.bmp
TBarMedm.bmp
Toolbar.bmp
workspace.ico
WorkspaceTabs.bmp
ResOrgApp.dsp
ResOrgApp_Res.hm
ResOrgApp_Res.resorg
ResOrgCore
Lint
Release
Res
Anna.bmp
BuildOptions.ico
ComCtl Version Prompt.rtf
File Reload Warning Ex.rtf
File Reload Warning.rtf
Global Next Symbol Value Warning Prompt.rtf
information.ico
Invalid Symbol Name.rtf
Mailing List Prompt.rtf
Next Symbol Value Warning Prompt.rtf
project context menu.bmp
project.ico
RenumWiz Completion.rtf
Report.ico
ResOrg Logo.bmp
ResOrg Updated.rtf
ResOrg.ico
resource file.ico
riverblade_logo.bmp
solution.ico
Symbol Delete Warning.rtf
Symbol Name Warning.rtf
Symbol Rename Warning.rtf
SymbolFile.ico
Symbols Delete Warning.rtf
sym_binary.ico
sym_bitmap.ico
sym_command.ico
sym_control.ico
sym_dialog.ico
sym_icon.ico
sym_menu.ico
sym_prompt.ico
sym_resource.ico
sym_string.ico
Toolbar.bmp
VcAddIn.ico
VersionCheck.ico
warning.ico
WizardHeader256.bmp
WizardWatermark256.bmp
ResOrgCore.def
ResOrgCore.dsp
ResOrgCore_Res.hm
ResOrgCore_Res.resorg
Xml
ProblemSymbolReportHtml.xsl
SymbolsReportHtml.xsl
ResOrgNETAddIn
AddIn.def
Release
Res
AddIn.rgs
HtmlDoc.ico
ResOrg.ico
ResOrgDoc.ico
Toolbar.bmp
WorkspaceTabs.bmp
ResOrgNETAddInSetup
Banner.jpg
Intro screen.jpg
Licence.rtf
ReadMe.rtf
Release
ResOrg.ico
ResOrgNETAddInSetup.vdproj
ResOrgNETAddInToolWindows
Release
Res
Edit.ico
Properties.ico
Renumber.ico
ResOrgNETAddInToolWindows.ico
ResOrgNETAddInToolWindowsCtrl.bmp
ResOrgNETAddInToolWindows.def
SatelliteDll
Release
res
AboutBoxCmd.bmp
OpenResOrgCmd.bmp
OptionsCmd.bmp
ViewMainToolWinCmd.bmp
/************************************************************************
 *
 *            Resource ID Organiser Add-In for Visual C++ .NET
 *
 * (c) Copyright 2000-2005 by Riverblade Limited (UK). All rights reserved.
 *
 ************************************************************************
 *
 *  Description : CConnect class - primary interface to Visual Studio .NET
 *
 *  Compiler    : Microsoft Visual C++ .NET 2003
 *                                                                       
 *  Target                                                               
 *  Environment : Windows 2000/XP
 *
 *  NOTE:
 *
 *    This software is provided "as is". All title and copyrights in and
 *    to the software, including but not limited to any images, text etc.
 *    etc. incorporated into it, are the property of Anna-Jayne Metcalfe
 *    and Riverblade Limited, except where acknowledged otherwise.
 *
 *    Your may freely use this code in your own products, PROVIDED
 *    this notice is not removed or modified.
 *
 *    Please visit http://www.riverblade.co.uk/products/resorg or email
 *    support@riverblade.co.uk for latest updates and product support 
 *
 ************************************************************************
 *
 *   MODIFICATION HISTORY:
 *
 *           This is a controlled document. See project configuration
 *           control tool for latest version and full version history.
 *
 *    $Archive: /Projects/AddIns/ResOrg/ResOrgNETAddIn/Connect.h $
 *   $Revision: 13 $
 *       $Date: 28/12/04 9:40 $
 *     $Author: Anna $
 *
 *    $History: Connect.h $
 * 
 * *****************  Version 13  *****************
 * User: Anna         Date: 28/12/04   Time: 9:40
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * 1.  Added satellite DLL
 * 2.  Added icon to toolwindow
 * 3.  Minor mods for stability
 * 4.  Updated banner
 * 
 * 
 * *****************  Version 12  *****************
 * User: Anna         Date: 20/12/04   Time: 10:13
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * 1.  Changed the initialisation sequence to attempt to make it more
 * reliable
 * 2.  Added event unadvise during OnDisconnection()
 * 3.  Added icon to the toolwindow
 * 
 * *****************  Version 11  *****************
 * User: Anna         Date: 25/11/02   Time: 15:27
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Changed website address in banner
 * 
 * *****************  Version 10  *****************
 * User: Anna         Date: 22/10/02   Time: 14:15
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Changed name/email address (at last!)
 * 
 * *****************  Version 9  *****************
 * User: Andy         Date: 10/08/02   Time: 22:21
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * 1.  Fixed OnConnection() code...commands are now only setup if the
 * add-in has just been installed or manually reloaded
 * 2.  Tidied up the code
 * 
 * *****************  Version 8  *****************
 * User: Andy         Date: 10/08/02   Time: 0:16
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * 1.  Added groups to the toolbar (to make it wider so the caption would
 * fit!)
 * 2.  Fixed a window parenting problem when the main window of ResOrg was
 * opened on an expired version
 * 
 * *****************  Version 7  *****************
 * User: Andy         Date: 9/08/02    Time: 17:02
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Added "Options" and "AboutBox" commands
 * 
 * *****************  Version 6  *****************
 * User: Andy         Date: 7/08/02    Time: 22:15
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Improved the way menu commands are added
 * 
 * *****************  Version 5  *****************
 * User: Andy         Date: 6/08/02    Time: 10:36
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Removed unused code
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 5/08/02    Time: 13:49
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * 1.  Moved menu entries to a submenu under the Tools menu
 * 2.  Tidied up the code a little
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 1/08/02    Time: 16:44
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Further development of ResOrg.NET - particularly the tool window
 * 
 * *****************  Version 2  *****************
 * User: Andy         Date: 7/06/02    Time: 22:37
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddInVc7
 * Initial integration
 * 
 * *****************  Version 1  *****************
 * User: Andy         Date: 3/06/02    Time: 16:53
 * Created in $/Projects/AddIns/ResOrg/ResOrgAddInVc7
 *
 * $Nokeywords: $
 *
 ************************************************************************/

#pragma once

#include "ResOrgNETAddIn_Res.h"


#pragma warning( disable : 4278 )
//The following #import imports DTE based on it's LIBID
//#import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("7.0") lcid("0") raw_interfaces_only named_guids
#pragma warning( default : 4278 )

// CConnect
class ATL_NO_VTABLE CConnect : 
			public CComObjectRootEx<CComSingleThreadModel>,
			public CComCoClass<CConnect, &CLSID_Connect>,
			public IDispatchImpl<EnvDTE::IDTCommandTarget, &EnvDTE::IID_IDTCommandTarget, &EnvDTE::LIBID_EnvDTE, 7, 0>,
			public IDispatchImpl<AddInDesignerObjects::_IDTExtensibility2, &AddInDesignerObjects::IID__IDTExtensibility2, &AddInDesignerObjects::LIBID_AddInDesignerObjects, 1, 0>
{
// Construction/destruction
public:
			CConnect(void);

			~CConnect(void);

			
// ATL/COM stuff
DECLARE_REGISTRY_RESOURCEID(IDR_ADDIN)
DECLARE_NOT_AGGREGATABLE(CConnect)

BEGIN_COM_MAP(CConnect)
	COM_INTERFACE_ENTRY(AddInDesignerObjects::IDTExtensibility2)
	COM_INTERFACE_ENTRY(EnvDTE::IDTCommandTarget)
	COM_INTERFACE_ENTRY2(IDispatch, AddInDesignerObjects::IDTExtensibility2)
END_COM_MAP()


// Attributes
protected:
			CComPtr<EnvDTE::_DTE>	m_pDTE;
			CComPtr<EnvDTE::AddIn>	m_pAddInInstance;
			CComPtr<EnvDTE::Window> m_pwndMain;
			CComPtr<IDispatch>		m_pwndMainCtrl;
			HWND					m_hwndResOrg;
			

// Operations
public:
			DECLARE_PROTECT_FINAL_CONSTRUCT()

			HRESULT					FinalConstruct(void);
			void					FinalRelease(void);

// Interfaces
public:
			// IDTExtensibility2 implementation:
			STDMETHOD(OnConnection)		(IDispatch* pApplication,
										 AddInDesignerObjects::ext_ConnectMode eConnectMode,
										 IDispatch* pAddInInst,
										 SAFEARRAY** ppCustom);

			STDMETHOD(OnDisconnection)	(AddInDesignerObjects::ext_DisconnectMode eRemoveMode,
										 SAFEARRAY** custom );

			STDMETHOD(OnAddInsUpdate)	(SAFEARRAY** custom );

			STDMETHOD(OnStartupComplete)(SAFEARRAY** custom );

			STDMETHOD(OnBeginShutdown)	(SAFEARRAY** custom );

			
			// IDTCommandTarget implementation:
			STDMETHOD(QueryStatus)		(BSTR CmdName,
										 EnvDTE::vsCommandStatusTextWanted eNeededText,
										 EnvDTE::vsCommandStatus* pStatusOption,
										 VARIANT* pCommandText);

			STDMETHOD(Exec)				(BSTR CmdName,
										 EnvDTE::vsCommandExecOption eExecuteOption,
										 VARIANT* pVariantIn,
										 VARIANT* pVariantOut,
										 VARIANT_BOOL* pbHandled);

	// Implementation
protected:
			HRESULT					ConfigureEvents(void);
			HRESULT					UnadviseEvents(void);

			HRESULT					ConfigureCommands(void);

			bool					LoadCommandSpec(UINT uResourceID,
													CString& rsCmd,
													CString& rsButtonText,
													CString& rsToolTip,
													CString& rsKeyBinding,
													BOOL& rbHasBitmap) const;

			HRESULT					AddCommand(		CComPtrBase<EnvDTE::Commands>& pCommands, 
													CComPtr<EnvDTE::Command>& rpCommand,
													UINT uCmdSpecID,
													bool bEnabled);

			HRESULT					RemoveCommands(void);

			HRESULT					AddCommandToCommandBar(	CComPtrBase<Office::CommandBar>& pCommandBar,
															CComPtr<EnvDTE::Command> pCommand,
															LONG lPos,
															bool bBeginGroupBefore = false);

			HRESULT					CreateMainToolWindow(IDispatch* pApplication);

			HRESULT					RefreshMainToolWindow(void);

			void					ConnectApp(void);

			void					DisconnectApp(void);

			HWND					FindVisualStudioMainWnd(void) const;

			HRESULT					ToggleProjectViewCmd(void);

			HRESULT					OpenResOrgMainWindow(void);

			HRESULT					DoOptionsCmd(void);

			HRESULT					DoAboutBoxCmd(void);

			void					QueryStatusToggleViewToolWinCmd(EnvDTE::vsCommandStatusTextWanted eNeededText,
																	EnvDTE::vsCommandStatus* pStatusOption,
																	VARIANT* pvarCommandText);

	// I found this code in the MS VCEvents sample. All I can say is YUCK!
	class SolutionEventsSink : public IDispEventImpl<	1,
														SolutionEventsSink,
														&__uuidof(EnvDTE::_dispSolutionEvents),
														&EnvDTE::LIBID_EnvDTE,
														7,
														0>
	{
	protected:
			CComPtr<IDispatch>		m_pwndMainCtrl;


	public:
		BEGIN_SINK_MAP(SolutionEventsSink)
			SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispSolutionEvents), 1, Opened)
			SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispSolutionEvents), 2, BeforeClosing)
			SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispSolutionEvents), 3, AfterClosing)
			SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispSolutionEvents), 4, QueryCloseSolution)
			SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispSolutionEvents), 5, Renamed)
			SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispSolutionEvents), 6, ProjectAdded)
			SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispSolutionEvents), 7, ProjectRemoved)
			SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispSolutionEvents), 8, ProjectRenamed)
		END_SINK_MAP()

		bool					Initialise(IDispatch* pToolWindowCtrl)
									{ m_pwndMainCtrl = pToolWindowCtrl; return true; }

		HRESULT					RefreshMainToolWindow(void);

		void __stdcall Opened(void);
		void __stdcall BeforeClosing(void);
		void __stdcall AfterClosing(void);
		void __stdcall QueryCloseSolution(VARIANT_BOOL* fCancel);
		void __stdcall Renamed(BSTR bsOldName);
		void __stdcall ProjectAdded(EnvDTE::Project* pProject);
		void __stdcall ProjectRemoved(EnvDTE::Project* pProject);
		void __stdcall ProjectRenamed(EnvDTE::Project* pProject, BSTR bsOldName);

};
		SolutionEventsSink		m_SolutionEventsSink;
};


OBJECT_ENTRY_AUTO(__uuidof(Connect), CConnect)

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)

Share

About the Author

Anna-Jayne Metcalfe
Founder Riverblade Limited
United Kingdom United Kingdom
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...Laugh | :laugh:

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!

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150819.1 | Last Updated 10 Jan 2005
Article Copyright 2001 by Anna-Jayne Metcalfe
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid