-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDlgAbout.cpp
111 lines (88 loc) · 2.98 KB
/
DlgAbout.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*//////////////////////////////////////////////////////////////////////////////
// Name: dlgabout.cpp
// Purpose: Implementation of CDlgAbout
// Author: Ruediger Herrmann
// Copyright: (c) Ruediger Herrmann
//////////////////////////////////////////////////////////////////////////////*/
#include "stdafx.h"
#include "ECTImportX.h"
#include "DlgAbout.h"
#include "Module.h"
#include "helpcontextmap.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CDlgAbout::CDlgAbout(CWnd* pParent)
: CDialog(CDlgAbout::IDD, pParent) {
//{{AFX_DATA_INIT(CDlgAbout)
//}}AFX_DATA_INIT
}
void CDlgAbout::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgAbout)
DDX_Control(pDX, IDC_EMAIL, m_EMail);
DDX_Control(pDX, IDC_ABOUTICON, m_AboutIcon);
DDX_Control(pDX, IDC_VERSION, m_Version);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgAbout, CDialog)
//{{AFX_MSG_MAP(CDlgAbout)
ON_WM_HELPINFO()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CDlgAbout::OnInitDialog()
{
CDialog::OnInitDialog();
// load and display logo icon
HICON IconHandle = LoadIcon ( theApp.m_hInstance, MAKEINTRESOURCE ( IDI_ABOUTDLL ) );
if ( IconHandle != NULL )
m_AboutIcon.SetIcon ( IconHandle );
// set mail address
CString eMail = _T("");
eMail.LoadString( IDS_EMAIL );
m_EMail.SetWindowText( eMail );
// get filename
CString ModuleFilename;
if ( GetModuleFileName ( theApp.m_hInstance, ModuleFilename.GetBufferSetLength ( MAX_PATH + 1 ), MAX_PATH ) == 0 )
return TRUE;
ModuleFilename.ReleaseBuffer();
// determine version info size
DWORD VersionInfoSize;
DWORD NonsenseHandle;
VersionInfoSize = GetFileVersionInfoSize ( ModuleFilename.GetBuffer ( 0 ), &NonsenseHandle );
if ( VersionInfoSize == 0 )
return TRUE;
// allocate memory for and then get version info data block
LPVOID VersionData;
VersionData = malloc ( VersionInfoSize );
if ( !GetFileVersionInfo ( ModuleFilename.GetBuffer ( 0 ), NonsenseHandle, VersionInfoSize, VersionData ) )
return TRUE;
// get fixed version info
VS_FIXEDFILEINFO* FixedFileInfo = NULL;
UINT FixedFileInfoSize;
if ( !VerQueryValue ( VersionData, _T("\\"), (void**) &FixedFileInfo, &FixedFileInfoSize ) )
{
free ( VersionData );
return TRUE;
}
CString Version;
Version.Format ( IDS_VERSION, HIWORD ( FixedFileInfo->dwProductVersionMS ), LOWORD ( FixedFileInfo->dwProductVersionMS ), HIWORD ( FixedFileInfo->dwProductVersionLS ), LOWORD ( FixedFileInfo->dwProductVersionLS ) );
m_Version.SetWindowText ( Version );
// free version info block
free ( VersionData );
return TRUE;
}
BOOL CDlgAbout::OnHelpInfo(HELPINFO* pHelpInfo)
{
char exefilename[MAX_PATH];
char *cp;
if (::GetModuleFileName(theApp.m_hInstance, exefilename, MAX_PATH) && (cp = strrchr(exefilename, '\\')))
{
strcpy(cp, "\\ECTEImport.htm");
::ShellExecute(NULL, "open", exefilename, NULL, NULL, SW_SHOWNORMAL);
}
return CDialog::OnHelpInfo ( pHelpInfo );
}