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

📄 about.cpp

📁 一个邮件客户端源代码,包括收发邮件,安排日程等很多内容
💻 CPP
字号:
// Copyright (C) 1997-2002 Valeriy Ovechkin
// 
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// About.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "About.h"
#include "VersionPage.h"
#include "GuestbookPage.h"
#include "AuthorPage.h"
#include "sfpage.h"

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

//
//	Note!
//
//		If this DLL is dynamically linked against the MFC
//		DLLs, any functions exported from this DLL which
//		call into MFC must have the AFX_MANAGE_STATE macro
//		added at the very beginning of the function.
//
//		For example:
//
//		extern "C" BOOL PASCAL EXPORT ExportedFunction()
//		{
//			AFX_MANAGE_STATE(AfxGetStaticModuleState());
//			// normal function body here
//		}
//
//		It is very important that this macro appear in each
//		function, prior to any calls into MFC.  This means that
//		it must appear as the first statement within the 
//		function, even before any object variable declarations
//		as their constructors may generate calls into the MFC
//		DLL.
//
//		Please see MFC Technical Notes 33 and 58 for additional
//		details.
//

/////////////////////////////////////////////////////////////////////////////
// CAboutApp

BEGIN_MESSAGE_MAP(CAboutApp, CWinApp)
	//{{AFX_MSG_MAP(CAboutApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAboutApp construction

CAboutApp::CAboutApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CAboutApp object

CAboutApp theApp;

extern "C" BOOL PASCAL EXPORT ShowAboutBox()
{
	AFX_MANAGE_STATE( AfxGetStaticModuleState() );
	
	CVersionPage pageV; 
	CGuestbookPage pageG; 
	CAuthorPage pageA; 
	SFPage	pageSF;

	CString strTitle;
	AfxFormatString1( strTitle, IDP_ABOUT_BOX_TITLE_1, theApp.m_strProductName );	
	CPropertySheet sheet( strTitle, AfxGetMainWnd() );
	sheet.AddPage( &pageV );
	sheet.AddPage( &pageG );
	sheet.AddPage( &pageA );
	sheet.AddPage( &pageSF );
	
	sheet.m_psh.dwFlags |= PSH_NOAPPLYNOW;

	sheet.DoModal();

	return 0;
}


BOOL CAboutApp::InitInstance() 
{
	// preload icons in full color (!)
	{
		::LoadImage( m_hInstance, MAKEINTRESOURCE( IDI_AUTHOR ), IMAGE_ICON, 0, 0, 
			LR_CREATEDIBSECTION | LR_SHARED );

		::LoadImage( m_hInstance, MAKEINTRESOURCE( IDI_GUESTBOOK ), IMAGE_ICON, 0, 0, 
			LR_CREATEDIBSECTION | LR_SHARED );
	}

	if( !CWinApp::InitInstance() ) return 0;

	DWORD dwZero = 0;
	DWORD dwBufferSize = GetFileVersionInfoSize( _T("magic.exe"), &dwZero );

	char *pBuffer = new char[ dwBufferSize ];
	VERIFY( GetFileVersionInfo( _T("magic.exe"), 0, dwBufferSize, pBuffer ) );

	char *pVerInfo = 0;
	UINT uintVerInfoSize = 0;
/*
	if( VerQueryValue( pBuffer, _T("\\"), (void**) &pVerInfo, &uintVerInfoSize ) )
	{
		VS_FIXEDFILEINFO &FixedFileInfo = *(VS_FIXEDFILEINFO*) pVerInfo;
	}
*/	

	if( VerQueryValue( pBuffer, _T("\\StringFileInfo\\040904b0\\Comments"), (void**) &pVerInfo, &uintVerInfoSize ) )
	{
		TCHAR *tszTmp = new TCHAR[ uintVerInfoSize ];
		OemToChar( pVerInfo, tszTmp );
		m_strComments = tszTmp;
		delete tszTmp;
	}
	
	if( VerQueryValue( pBuffer, _T("\\StringFileInfo\\040904b0\\FileDescription"), (void**) &pVerInfo, &uintVerInfoSize ) )
	{
		TCHAR *tszTmp = new TCHAR[ uintVerInfoSize ];
		OemToChar( pVerInfo, tszTmp );
		m_strFileDescription = tszTmp;
		delete tszTmp;
	}
	
	if( VerQueryValue( pBuffer, _T("\\StringFileInfo\\040904b0\\LegalCopyright"), (void**) &pVerInfo, &uintVerInfoSize ) )
	{
		TCHAR *tszTmp = new TCHAR[ uintVerInfoSize ];
		OemToChar( pVerInfo, tszTmp );
		m_strLegalCopyright = tszTmp;
		delete tszTmp;
	}
	
	if( VerQueryValue( pBuffer, _T("\\StringFileInfo\\040904b0\\ProductName"), (void**) &pVerInfo, &uintVerInfoSize ) )
	{
		TCHAR *tszTmp = new TCHAR[ uintVerInfoSize ];
		OemToChar( pVerInfo, tszTmp );
		m_strProductName = tszTmp;
		delete tszTmp;
	}
	
	if( VerQueryValue( pBuffer, _T("\\StringFileInfo\\040904b0\\ProductVersion"), (void**) &pVerInfo, &uintVerInfoSize ) )
	{
		TCHAR *tszTmp = new TCHAR[ uintVerInfoSize ];
		OemToChar( pVerInfo, tszTmp );
		m_strProductVersion = tszTmp;
		delete tszTmp;
	}

	if( VerQueryValue( pBuffer, _T("\\StringFileInfo\\040904b0\\SpecialBuild"), (void**) &pVerInfo, &uintVerInfoSize ) )
	{
		TCHAR *tszTmp = new TCHAR[ uintVerInfoSize ];
		OemToChar( pVerInfo, tszTmp );
		m_strSpecialBuild = tszTmp;
		delete tszTmp;
	}
	
	m_strShortVersion = _T("v");
	m_strShortVersion += m_strProductVersion[0];
	m_strShortVersion += _T(".");
	m_strShortVersion += m_strProductVersion[3];
	if( _T('0') != m_strProductVersion[6] || _T('0') != m_strProductVersion[9] )
	{
		m_strShortVersion += m_strProductVersion[6];
	}
	if( _T('0') != m_strProductVersion[9] ) 
	{
		m_strShortVersion += _T("b");
		m_strShortVersion += m_strProductVersion[9];
		if (m_strProductVersion.GetLength()>10)
			m_strShortVersion += m_strProductVersion[10];
	}

	delete pBuffer;

	return 1;
}

void CAboutApp::FollowLink( UINT nStringID )
{
	CString strString;
	strString.LoadString( nStringID );
	FollowLink( strString );
}

void CAboutApp::FollowLink( LPCTSTR tszLink )
{
	if( (int) ShellExecute( NULL, _T("open"), tszLink, _T(""), _T(""), SW_NORMAL ) < 32 )
	{
		CString strMessage;
		AfxFormatString1( strMessage, IDP_CANNOT_FOLLOW_THE_LINK_1, tszLink );
		AfxMessageBox( strMessage, MB_ICONSTOP );
	}
}

⌨️ 快捷键说明

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