1 // AboutDialog.cpp
2
3 #include "StdAfx.h"
4
5 #include "../../../../C/CpuArch.h"
6
7 #include "../../MyVersion.h"
8
9 #include "../Common/LoadCodecs.h"
10
11 #include "AboutDialog.h"
12 #include "PropertyNameRes.h"
13
14 #include "HelpUtils.h"
15 #include "LangUtils.h"
16
17 #ifdef Z7_LANG
18 static const UInt32 kLangIDs[] =
19 {
20 IDT_ABOUT_INFO
21 };
22 #endif
23
24 #define kHomePageURL TEXT("https://www.7-zip.org/")
25 #define kHelpTopic "start.htm"
26
27 #define LLL_(quote) L##quote
28 #define LLL(quote) LLL_(quote)
29
30 extern CCodecs *g_CodecsObj;
31
OnInit()32 bool CAboutDialog::OnInit()
33 {
34 #ifdef Z7_EXTERNAL_CODECS
35 if (g_CodecsObj)
36 {
37 UString s;
38 g_CodecsObj->GetCodecsErrorMessage(s);
39 if (!s.IsEmpty())
40 MessageBoxW(GetParent(), s, L"7-Zip", MB_ICONERROR);
41 }
42 #endif
43
44 #ifdef Z7_LANG
45 LangSetWindowText(*this, IDD_ABOUT);
46 LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
47 #endif
48 SetItemText(IDT_ABOUT_VERSION, UString("7-Zip " MY_VERSION_CPU));
49 SetItemText(IDT_ABOUT_DATE, LLL(MY_DATE));
50
51 NormalizePosition();
52 return CModalDialog::OnInit();
53 }
54
OnHelp()55 void CAboutDialog::OnHelp()
56 {
57 ShowHelpWindow(kHelpTopic);
58 }
59
OnButtonClicked(unsigned buttonID,HWND buttonHWND)60 bool CAboutDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
61 {
62 LPCTSTR url;
63 switch (buttonID)
64 {
65 case IDB_ABOUT_HOMEPAGE: url = kHomePageURL; break;
66 default:
67 return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
68 }
69
70 #ifdef UNDER_CE
71 SHELLEXECUTEINFO s;
72 memset(&s, 0, sizeof(s));
73 s.cbSize = sizeof(s);
74 s.lpFile = url;
75 ::ShellExecuteEx(&s);
76 #else
77 ::ShellExecute(NULL, NULL, url, NULL, NULL, SW_SHOWNORMAL);
78 #endif
79
80 return true;
81 }
82