📄 resorgsplashwnd.cpp
字号:
/************************************************************************
*
* Resource ID Organiser Application
*
* (c) Copyright 2001 by Andy Metcalfe (andy.metcalfe@lineone.net)
* All rights reserved.
*
************************************************************************
*
* Filename : ResOrgSplashWnd.cpp
*
* Description : CResOrgSplashWnd - splash screen 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/ResOrgSplashWnd.cpp $
* $Revision: 3 $
* $Date: 23/05/01 16:10 $
* $Author: Andy $
*
* $History: ResOrgSplashWnd.cpp $
*
* ***************** Version 3 *****************
* User: Andy Date: 23/05/01 Time: 16:10
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* Display file version instead of product version
*
* ***************** Version 2 *****************
* User: Andy Date: 24/04/01 Time: 12:44
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* Added expiry warning
*
* ***************** Version 1 *****************
* User: Andy Date: 21/04/01 Time: 7:16
* Created in $/Projects/AddIns/ResOrg/ResOrgUtils
*
* $Nokeywords: $
*
************************************************************************/
// ResOrgSplashWnd.cpp : implementation file
//
#include "StdAfx.h"
#include "ResOrgUtils_Priv.h"
#include "ResOrgSplashWnd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CResOrgSplashWnd class
CResOrgSplashWnd::CResOrgSplashWnd(UINT nIDTemplate /*= CResOrgSplashWnd::IDD*/, CWnd* pParent /*=NULL*/)
: CResOrgSplashWnd_BASE(nIDTemplate, pParent)
{
//{{AFX_DATA_INIT(CResOrgSplashWnd)
m_sVersion = _T("");
m_sCopyright = _T("");
//}}AFX_DATA_INIT
}
void CResOrgSplashWnd::DoDataExchange(CDataExchange* pDX)
{
CResOrgSplashWnd_BASE::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CResOrgSplashWnd)
DDX_Text(pDX, IDC_RESORG_VERSION, m_sVersion);
DDX_Text(pDX, IDC_RESORG_COPYRIGHT, m_sCopyright);
DDX_Control(pDX, IDC_RESORG_EXPIRY, m_ctrlExpiry);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CResOrgSplashWnd, CResOrgSplashWnd_BASE)
//{{AFX_MSG_MAP(CResOrgSplashWnd)
ON_WM_CTLCOLOR()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResOrgSplashWnd message handlers
/******************************************************************************
* Called when the dialog is created
*
******************************************************************************/
BOOL CResOrgSplashWnd::OnInitDialog(void)
{
CResOrgSplashWnd_BASE::OnInitDialog(); // returns TRUE unless you set the focus to a control
// Create the background brush
m_Brush.CreateSolidBrush( RGB(255, 255, 204) );
// 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_sVersion = _T("Version ") + ver.GetValue( _T("FileVersion") );
m_sCopyright = ver.GetValue( _T("LegalCopyright") );
UpdateData(FALSE);
#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);
}
m_ctrlExpiry.SetWindowText(sExpiryMsg);
m_ctrlExpiry.ShowWindow(SW_RESTORE);
#endif
return TRUE; // Return TRUE unless you set the focus to a control
}
/******************************************************************************
* Create and display the splash window
*
* Overriden so that the app can create the splash window without knowing the
* dialog template ID
*
******************************************************************************/
BOOL CResOrgSplashWnd::Create(CWnd* pParent)
{
if (!CResOrgSplashWnd_BASE::Create(CResOrgSplashWnd::IDD, pParent))
{
TRACE0("CResOrgSplashWnd: Warning: creation of dialog failed\n");
return FALSE;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CResOrgSplashWnd message handlers
HBRUSH CResOrgSplashWnd::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
UNREFERENCED_PARAMETER(nCtlColor);
HBRUSH hbr = m_Brush;
UINT uID = pWnd->GetDlgCtrlID();
if (uID > 0)
{
// Set the background mode for text to transparent
// so the background will show through
pDC->SetBkMode(TRANSPARENT);
switch (uID)
{
case IDC_RESORG_TITLE:
case IDC_RESORG_PLATFORM:
case IDC_RESORG_VERSION:
pDC->SetTextColor( RGB(0, 0, 200) );
break;
default:
break;
}
}
return hbr;
}
void CResOrgSplashWnd::OnPaint(void)
{
CPaintDC dc(this); // device context for painting
// Select a hollow brush
CBrush* pOldBrush = (CBrush*)dc.SelectStockObject(HOLLOW_BRUSH);
// Create and select a thick, blue pen
CPen pen;
pen.CreatePen(PS_SOLID, 5, RGB(0, 0, 200));
CPen* pOldPen = (CPen*)dc.SelectObject(&pen);
// Get our client rectangle so we can to use it to
// draw a bounding rectangle around the splash screen
CRect rect;
GetClientRect(rect);
// Draw a hollow rectangle
dc.Rectangle(rect);
// Restore the original pen and brush
dc.SelectObject(pOldBrush);
dc.SelectObject(pOldPen);
// Do not call CResOrgSplashWnd_BASE::OnPaint() for painting messages
}
/////////////////////////////////////////////////////////////////////////////
// CResOrgSplashWnd implementation
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -