www.pudn.com > BesidesFTPServer.rar > AboutDlg.cpp
/****************************************************************/
/* */
/* AboutDlg.cpp */
/* */
/* Implementation of the CAboutDlg class. */
/* This class is a part of the FTP Server. */
/* */
/* Do not change the credits!!! */
/* */
/* Programmed by LQB van der Meer */
/* Copyright LQB Software Solutions 2002 */
/* http://www.pablovandermeer.nl */
/* */
/* Last updated: 17 Oktober 2002 */
/* */
/****************************************************************/
#include "stdafx.h"
#include "resource.h"
#include "AboutDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAboutDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAboutDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Control(pDX, IDC_STARWARS, m_StarWarsCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/********************************************************************/
/* */
/* Function name : OnInitDialog */
/* Description : Initailize dialog. */
/* */
/********************************************************************/
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_StarWarsCtrl.AddTextLine("效率的提高");
m_StarWarsCtrl.AddTextLine("");
m_StarWarsCtrl.AddTextLine("源于信息的共享");
m_StarWarsCtrl.AddTextLine("");
m_StarWarsCtrl.AddTextLine("我们的目标");
m_StarWarsCtrl.AddTextLine("");
m_StarWarsCtrl.AddTextLine("让信息更安全的共享");
m_StarWarsCtrl.AddTextLine("");
m_StarWarsCtrl.AddTextLine("");
CString strAppName = AfxGetApp()->GetProfileString("Settings", "AppName", "lqb's FTP Server");
m_StarWarsCtrl.AddTextLine(strAppName);
CString strExeName = AfxGetApp()->m_pszExeName;
strExeName += ".exe";
GetVersionInformation(strExeName);
m_StarWarsCtrl.AddTextLine(GetVersionInformation(strExeName));
// do not change these lines !!!
m_StarWarsCtrl.AddTextLine("");
m_StarWarsCtrl.AddTextLine("");
m_StarWarsCtrl.AddTextLine("Copyright 2004");
m_StarWarsCtrl.AddTextLine("WEB软件");
m_StarWarsCtrl.AddTextLine("");
m_StarWarsCtrl.AddTextLine("aovi@sina.com");
m_StarWarsCtrl.AddTextLine("");
m_StarWarsCtrl.AddTextLine("");
m_StarWarsCtrl.AddTextLine("FTP服务器");
m_StarWarsCtrl.AddTextLine(" OF ");
m_StarWarsCtrl.AddTextLine("远程传输系统");
m_StarWarsCtrl.AddTextLine(" BY ");
m_StarWarsCtrl.AddTextLine("李全滨");
m_StarWarsCtrl.AddTextLine("版本 V0.12");
return TRUE;
}
/********************************************************************/
/* */
/* Function name : UpdateVersionInformation */
/* Description : Show version information from resource. */
/* */
/********************************************************************/
CString CAboutDlg::GetVersionInformation(LPCTSTR lpszModuleName)
{
CString strResult;
BYTE *pDataBlock = NULL;
DWORD FAR *translation;
DWORD FAR *buffer;
DWORD dwHandle;
UINT nBytes;
// WinAPI wants non-const arguments
LPTSTR lpszExeName = const_cast(lpszModuleName);
char szName[512]; // StringFileInfo data block.
// Get the actual size of the information block.
nBytes = (UINT)GetFileVersionInfoSize(lpszExeName, &dwHandle);
if (nBytes)
{
pDataBlock = new BYTE[nBytes];
// Get the actual block for the version information
if (GetFileVersionInfo(lpszExeName, dwHandle, nBytes, pDataBlock))
{
if (VerQueryValue(pDataBlock, "\\VarFileInfo\\Translation", (VOID FAR * FAR *)&translation, (UINT FAR *)&nBytes))
{
// The File Version for this application
wsprintf(szName, "\\StringFileInfo\\%04x%04x\\PrivateBuild", LOWORD(*translation), HIWORD(*translation));
if (VerQueryValue(pDataBlock, szName, (VOID FAR * FAR *)&buffer, (UINT FAR *)&nBytes))
{
strResult.Format((char far *)buffer);
}
}
else
{
// sorry ...
}
}
if (pDataBlock)
delete[] pDataBlock;
}
return strResult;
}