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

📄 openmainwindowcommandhandler.cpp

📁 ResOrg 图形化管理Vc项目的资源ID的工具的源代码。 ResOrg - Manage and Renumber Resource Symbol IDs Introduction The
💻 CPP
字号:
/************************************************************************
 *
 *            Resource ID Organiser Add-In for Visual C++ .NET
 *
 * (c) Copyright 2000-2005 by Riverblade Limited (UK). All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Description : COpenMainWindowCommandHandler - Handles the ResOrg
 *                "Open Main Window" command.
 *
 *  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/OpenMainWindowCommandHandler.cpp $
 *   $Revision: 2 $
 *       $Date: 22/10/05 11:56 $
 *     $Author: Anna $
 *
 *    $History: OpenMainWindowCommandHandler.cpp $
 * 
 * *****************  Version 2  *****************
 * User: Anna         Date: 22/10/05   Time: 11:56
 * Updated in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * Integrated ATL CMainToolWindowCtrl, which replaces the original MFC OLE
 * Control [IMS ID 125]
 * 
 * *****************  Version 1  *****************
 * User: Anna         Date: 16/10/05   Time: 17:23
 * Created in $/Projects/AddIns/ResOrg/ResOrgNETAddIn
 * 
 * $Nokeywords: $
 *
 ************************************************************************/

#include "StdAfx.h"

#include "OpenMainWindowCommandHandler.h"


const UINT WM_RESORG_OPEN = ::RegisterWindowMessage( _T("ResOrgShowMainWnd") );

/////////////////////////////////////////////////////////////////////////////
// COpenMainWindowCommandHandler construction/destruction

COpenMainWindowCommandHandler::COpenMainWindowCommandHandler(	const CComPtr<EnvDTE::_DTE>& pDTE,
																const _bstr_t& bsCommandName,
																HWND hwndResOrg) :
	CAddInCommandHandler(pDTE, bsCommandName),
	m_hwndResOrg(hwndResOrg)
{
	//ATLASSERT(NULL != m_hwndResOrg);
}


COpenMainWindowCommandHandler::~COpenMainWindowCommandHandler(void)
{
	m_hwndResOrg = NULL;
}


/////////////////////////////////////////////////////////////////////////////
// COpenMainWindowCommandHandler operations
// (none)



/////////////////////////////////////////////////////////////////////////////
// COpenMainWindowCommandHandler virtual overrides

HRESULT COpenMainWindowCommandHandler::QueryStatus(	BSTR bstrCmdName,
													EnvDTE::vsCommandStatusTextWanted NeededText,
													EnvDTE::vsCommandStatus* pStatusOption,
													VARIANT* pvarCommandText)
{
	UNREFERENCED_PARAMETER(bstrCmdName);
	UNREFERENCED_PARAMETER(NeededText);
	UNREFERENCED_PARAMETER(pvarCommandText);

	//lint -save -e655 (Warning -- bit-wise operation uses (compatible) enum's)
	*pStatusOption = (EnvDTE::vsCommandStatus)(EnvDTE::vsCommandStatusEnabled | EnvDTE::vsCommandStatusSupported);
	//lint -restore

	return S_OK;
}


HRESULT COpenMainWindowCommandHandler::Exec(BSTR bstrCmdName,
											EnvDTE::vsCommandExecOption ExecuteOption,
											VARIANT* pvarVariantIn,
											VARIANT* pvarVariantOut,
											VARIANT_BOOL* pvbHandled)
{
	AFX_MANAGE_STATE( ::AfxGetStaticModuleState() );

	UNREFERENCED_PARAMETER(bstrCmdName);
	UNREFERENCED_PARAMETER(ExecuteOption);
	UNREFERENCED_PARAMETER(pvarVariantIn);
	UNREFERENCED_PARAMETER(pvarVariantOut);

	if (::IsWindow(m_hwndResOrg) )
	{
		#ifdef _RESORG_EXPIRY_DATE
			// Because this add-in is implemented as a Regular DLL with a
			// mainframe window the usual trick of calling EnableModeless()
			// isn't enough to ensure that modal dialogs behave correctly -
			// we also have to ensure that any dialogs are parented by
			// DevStudio's main window rather than our own...
			HWND hWndDevStudio = FindVisualStudioMainWnd();

			CWnd* pWnd = CWnd::FromHandle(hWndDevStudio);

			::DoVersionExpiryCheck(pWnd);
		#endif

		::SendMessage(m_hwndResOrg, WM_RESORG_OPEN,	0, (LPARAM)0);
	}
	*pvbHandled = VARIANT_TRUE;

	return S_OK;
}

⌨️ 快捷键说明

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