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

📄 resorgaboutbox.cpp

📁 一个vc中管理资源文件ID的插件
💻 CPP
字号:
/************************************************************************
 *
 *                 Resource ID Organiser Utility Library
 *
 *       (c) Copyright 2000 by Andy Metcalfe (andy.metcalfe@lineone.net)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : ResOrgAboutBox.cpp
 *
 *  Description : CResOrgAboutBox - "About Box" dialog class
 *                
 *  Compiler    : Microsoft Visual C++ 6.0, Service Pack 3 or 4
 *                                                                       
 *  Target                                                               
 *  Environment : Windows 98/NT
 *
 *  NOTE:
 *
 *    This software is provided "as is" free for personal use. All
 *    title and copyrights in and to the software, including but not
 *    limited to any images, text, etc. incorporated into it, are
 *    owned by Andy Metcalfe, except where acknowledged otherwise.
 *
 *    Your may freely to use this code in your own products, PROVIDED
 *    this notice is not removed or modified.
 *
 *
 *    Visit http://www.resorg.co.uk for latest updates
 *
 ************************************************************************
 *
 *   MODIFICATION HISTORY:
 *
 *           This is a controlled document. See project configuration
 *           control tool for latest version and full version history.
 *
 *    $Archive: /Projects/AddIns/ResOrg/ResOrgUtils/ResOrgAboutBox.cpp $
 *   $Revision: 6 $
 *       $Date: 8/06/01 20:24 $
 *     $Author: Andy $
 *
 *    $History: ResOrgAboutBox.cpp $
 * 
 * *****************  Version 6  *****************
 * User: Andy         Date: 8/06/01    Time: 20:24
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Corrected the email URL (it was adding an extra "mailto" to the URL)
 * 
 * *****************  Version 5  *****************
 * User: Andy         Date: 5/04/01    Time: 6:11
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added check for version expiry (conditional compilation)
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 29/11/00   Time: 19:00
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Legal copyright string is now assumed to be complete, rather than
 * adding company name on automatically
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 29/11/00   Time: 18:38
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 *  Added file banners
 *
 * $Nokeywords: $
 *
 ************************************************************************/

// ResOrgAboutBox.cpp : implementation file
//

#include "StdAfx.h"
#include "ResOrgUtils_Priv.h"

#include "ResOrgAboutBox.h"

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

/////////////////////////////////////////////////////////////////////////////
// CResOrgAboutBox dialog


CResOrgAboutBox::CResOrgAboutBox(CWnd* pParent /*=NULL*/)
	: CResOrgAboutBox_BASE(CResOrgAboutBox::IDD, pParent)
{
	//{{AFX_DATA_INIT(CResOrgAboutBox)
	m_sTitle		= _T("");
	m_sFileVersion	= _T("");
	m_sCopyright	= _T("");
	m_sWebsite		= _T("http://www.resorg.co.uk");
	m_sMailTo		= _T("andy.metcalfe@lineone.net");
	//}}AFX_DATA_INIT
}


void CResOrgAboutBox::DoDataExchange(CDataExchange* pDX)
{
	CResOrgAboutBox_BASE::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CResOrgAboutBox)
	DDX_Text(pDX,		IDC_RESORG_TITLE,			m_sTitle);
	DDX_Text(pDX,		IDC_RESORG_VERSION,			m_sFileVersion);
	DDX_Text(pDX,		IDC_RESORG_COPYRIGHT,		m_sCopyright);
	DDX_Text(pDX,		IDC_RESORG_WEBSITE,			m_sWebsite);
	DDX_Control(pDX,	IDC_RESORG_WEBSITE,			m_ctrlWebsite);
	DDX_Text(pDX,		IDC_RESORG_MAILTO,			m_sMailTo);
	DDX_Control(pDX,	IDC_RESORG_MAILTO,			m_ctrlEmail);
	DDX_Control(pDX,	IDC_RESORG_EXPIRY,			m_ctrlExpiry);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CResOrgAboutBox, CResOrgAboutBox_BASE)
	//{{AFX_MSG_MAP(CResOrgAboutBox)
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CResOrgAboutBox overrides

/******************************************************************************
 *	Called when the dialog is created
 *
 ******************************************************************************/

BOOL CResOrgAboutBox::OnInitDialog(void)
{
	CResOrgAboutBox_BASE::OnInitDialog();			// returns TRUE  unless you set the focus to a control

	// Set the font for the app title
	// TO DO: get the font name and size from the string table
	CWnd* pWnd = GetDlgItem(IDC_RESORG_TITLE);
	if (pWnd != NULL)
	{
		HDC hDC = ::GetDC(NULL);
		int nFontSize = 14;
		LONG nHeight = 0 - ::GetDeviceCaps(hDC, LOGPIXELSY) * nFontSize / 72;
		::ReleaseDC(NULL, hDC);

		m_fontTitle.SetFaceName( _T("Verdana") );
		m_fontTitle.SetBold(TRUE);
		m_fontTitle.SetHeight(nHeight);

		pWnd->SetFont(&m_fontTitle);
	}
	// Read the fields we need from the version resource
	// If any can't be found, they will be blank
	CNGModuleVersion ver;
	ver.GetFileVersionInfo();

	m_sTitle		= ver.GetValue( _T("FileDescription") );
	m_sFileVersion	= ver.GetValue( _T("FileVersion") );
	m_sCopyright	= ver.GetValue( _T("LegalCopyright") );

	// Initialise the URL links
	if (!m_sWebsite.IsEmpty())
	{
		m_ctrlWebsite.SetURL(m_sWebsite);
	}
	if (!m_sMailTo.IsEmpty())
	{
		// Makeup URL including subject as app name/version
		CString sSubject = m_sTitle + _T(" version ") + m_sFileVersion;

		CString sEmailURL =	_T("mailto:") +
							m_sMailTo +
							_T("?Subject=") +
							sSubject;

		m_ctrlEmail.SetURL(sEmailURL);
	}

#ifdef _RESORG_EXPIRY_DATE

	CString sExpiryMsg;
	if (::IsVersionExpired() )
	{
		sExpiryMsg.LoadString(IDP_RESORG_EXPIRED);
	}
	else
	{
		CTime timeExpires = GetVersionExpiryDate();

		CString sExpiryTime = timeExpires.Format( _T("%A, %d %B, %Y") );

		sExpiryMsg.Format(IDP_RESORG_EXPIRY,
							sExpiryTime);

	}
	// Set the font for the warning
	// AJM 4/4/2001 disabled for now as I can't get
	// the fonts to match
	// TO DO: get the font name and size from the string table
/*
	HDC hDC = ::GetDC(NULL);
	
	int nFontSize = 9;
	LONG nHeight = 0 - ( (::GetDeviceCaps(hDC, LOGPIXELSY) * nFontSize) / 72);
	::ReleaseDC(NULL, hDC);

	m_fontExpiry.SetFaceName( _T("Arial") );
	m_fontExpiry.SetBold(TRUE);
	m_fontExpiry.SetHeight(nHeight);

	m_ctrlExpiry.SetFont(&m_fontExpiry);
*/
	m_ctrlExpiry.SetWindowText(sExpiryMsg);
	m_ctrlExpiry.ShowWindow(SW_RESTORE);
#endif
	
	UpdateData(FALSE);

	return TRUE;		// Return TRUE  unless you set the focus to a control
}


/////////////////////////////////////////////////////////////////////////////
// CResOrgAboutBox message handlers

HBRUSH CResOrgAboutBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CResOrgAboutBox_BASE::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	if (pWnd == GetDlgItem(IDC_RESORG_TITLE) )
	{
		// Set the text color to red
		pDC->SetTextColor(RGB(0, 128, 128));
	}
	return hbr;
}

⌨️ 快捷键说明

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