⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connect.cpp

📁 ResOrg 图形化管理Vc项目的资源ID的工具的源代码。 ResOrg - Manage and Renumber Resource Symbol IDs Introduction The
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/************************************************************************
 *
 *            Resource ID Organiser Add-In for Visual C++
 *
 * (c) Copyright 2000-2005 by Riverblade Limited (UK). All rights reserved.
 *
 ************************************************************************
 *
 *  Description : CConnect class - primary interface to Visual Studio
 *
 *  Compiler    : Microsoft Visual C++ .NET 2003
 *                                                                       
 *  Target                                                               
 *  Environment : Windows 2000/XP/Vista;
 *                Visual Studio 2002, 2003 or 2005
 *
 *  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.cpp $
 *   $Revision: 25 $
 *       $Date: 10/02/06 22:36 $
 *     $Author: Anna $
 *
 *    $History: Connect.cpp $
 * 
 * *****************  Version 25  *****************
 * User: Anna         Date: 10/02/06   Time: 22:36
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Minor bug fix
 * 
 * *****************  Version 24  *****************
 * User: Anna         Date: 24/10/05   Time: 11:36
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * CConnect::OnConnection() now recreates the add-in's commands if
 * necessary when it is loaded under normal startup conditions. This
 * should remove the need for re-installation solely to recreate the
 * add-ins's commands.
 * 
 * *****************  Version 23  *****************
 * User: Anna         Date: 22/10/05   Time: 11:12
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Integrated ATL CMainToolWindowCtrl, which replaces the original MFC OLE
 * Control [IMS ID 125]
 * 
 * *****************  Version 22  *****************
 * User: Anna         Date: 17/10/05   Time: 20:20
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Started integrating CAddInCommandHandler classes
 * 
 * *****************  Version 21  *****************
 * User: Anna         Date: 13/10/05   Time: 12:55
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Modified #imports for DTE and MSO to import smart pointer interfaces as
 * well as raw ones.
 * 
 * *****************  Version 20  *****************
 * User: Anna         Date: 31/12/04   Time: 16:28
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * 1.  Menu commands now have the icons displayed correctly
 * 2.  Added a separator before the "About ResOrg..." command
 * 
 * *****************  Version 19  *****************
 * 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 18  *****************
 * 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 17  *****************
 * User: Anna         Date: 19/03/03   Time: 18:29
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * CConnect::OnConnection() now shows a warning message if it fails to
 * configure commands
 * 
 * *****************  Version 16  *****************
 * User: Anna         Date: 25/11/02   Time: 15:27
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Changed website address in banner
 * 
 * *****************  Version 15  *****************
 * User: Anna         Date: 22/10/02   Time: 14:15
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Changed name/email address (at last!)
 * 
 * *****************  Version 14  *****************
 * User: Andy         Date: 13/08/02   Time: 12:48
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * CConnect::OnConnection() no longer recreates the commands etc. in
 * release builds if the connection mode is
 * AddInDesignerObjects::ext_cm_AfterStartup.
 * 
 * This prevents a crash if the add-in is loaded as a result of invoking a
 * command installed previously. Note that to facilitate testing, the
 * debug build still does this...
 * 
 * *****************  Version 13  *****************
 * User: Andy         Date: 10/08/02   Time: 22:46
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Fixed a compiler warning
 * 
 * *****************  Version 12  *****************
 * 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 11  *****************
 * 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 10  *****************
 * User: Andy         Date: 9/08/02    Time: 17:02
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Added "Options" and "AboutBox" commands
 * 
 * *****************  Version 9  *****************
 * User: Andy         Date: 8/08/02    Time: 20:36
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Added (debug only) code to retrieve the pathname of the satellite
 * DLL...so I can be sure I'm not really going mad here
 * 
 * *****************  Version 8  *****************
 * User: Andy         Date: 7/08/02    Time: 22:15
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Improved the way menu commands are added
 * 
 * *****************  Version 7  *****************
 * User: Andy         Date: 6/08/02    Time: 10:36
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Removed unused code
 * 
 * *****************  Version 6  *****************
 * 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 5  *****************
 * 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 4  *****************
 * User: Andy         Date: 22/06/02   Time: 0:36
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddInVc7
 * Minor tidying up
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 13/06/02   Time: 17:02
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddInVc7
 * Removed compiler warnings and changed ProgID string from
 * "ResOrgAddInVc7.Connect" to "ResOrgAddInVc7"
 * 
 * *****************  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: $
 *
 ************************************************************************/

#include "StdAfx.h"

#include "AddIn.h"
#include "ResOrgAddInApp.h"
//#include "MainFrame.h"
#include "OpenMainWindowCommandHandler.h"
#include "ViewToolWindowCommandHandler.h"
#include "OptionsCommandHandler.h"
#include "AboutBoxCommandHandler.h"

#include "Connect.h"



//	CVc7AutomationHelper hides away the grot of talking to the COM interfaces
//	exposed by Visual Studio...
CVc7AutomationHelper Workspace;


extern CAddInModule _Module;


CConnect::CConnect(void)
{
	m_hwndResOrg = NULL;
}


CConnect::~CConnect(void)
{
}


// When run, the Add-in wizard prepared the registry for the Add-in.
// At a later time, the Add-in or its commands may become unavailable for reasons such as:
//
//   1) You moved this project to a computer other than which is was originally created on.
//   2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
//   3) You add new commands or modify commands already defined.
//
// You will need to re-register the Add-in by building the ResOrgNETAddInSetup project,
// right-clicking the project in the Solution Explorer, and then choosing install.
// Alternatively, you could execute the ReCreateCommands.reg file the Add-in Wizard generated in 
// the project directory, or run 'devenv /setup' from a command prompt.


// CConnect
STDMETHODIMP CConnect::OnConnection(IDispatch* pApplication,
									AddInDesignerObjects::ext_ConnectMode eConnectMode,
									IDispatch* pAddInInst,
									SAFEARRAY** ppCustom)
{
	AFX_MANAGE_STATE( ::AfxGetStaticModuleState() );

	UNREFERENCED_PARAMETER(ppCustom);

	pApplication->QueryInterface(__uuidof(EnvDTE::_DTE), (LPVOID*)&m_pDTE);

	pAddInInst->QueryInterface(__uuidof(EnvDTE::AddIn), (LPVOID*)&m_pAddInInstance);

	Workspace.SetDTE(m_pDTE);

	// Initialise the document manager and create the mainframe
	ConnectApp();

	//lint -save -e650 (Warning -- Constant out of range for operator '==')
	if (5 == eConnectMode)
	//lint -restore
	{
		m_CommandManager.OnConnection(m_pDTE, m_pAddInInstance);

		// Create command handlers here so that they can remove existing commands
		// for us. Visual Studio .NET will unload the add-in immediately after
		// configuring it, so the add-in's UI doesn't need to be created
		m_CommandManager.CreateCommandHandlers();

		// Add our commands. Note that we must NOT show any modal UI at this stage
		// or our command bars and toolbar will be completely messed up!
		// If any failures occur here, we just ignore them and check the
		// consistency of the installation when OnConnection() is called with
		// eConnectMode set to ext_cm_AfterStartup or ext_cm_Startup.
		m_CommandManager.ConfigureCommands();
	}
	else
	{
		m_WindowManager.OnConnection(m_pDTE, m_pAddInInstance);

		if (m_WindowManager.CreateToolWindows() )
		{
			m_ptrMainToolWindow = m_WindowManager.GetMainToolWindow();

			m_pMainToolWindowCtrl = m_WindowManager.GetMainToolWindowCtrl();
			m_pMainToolWindowCtrl->Initialise(m_pDTE, m_hwndResOrg);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -