-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabout_dialog.c
114 lines (99 loc) · 2.99 KB
/
about_dialog.c
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
112
113
114
#include "about_dialog.h"
#include "defs.h"
#include "resource.h"
/******************************************************************************/
static INT_PTR CALLBACK AboutProc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
HICON hAppIco;
hAppIco = (HICON)LoadImage(
g_hInstance,
MAKEINTRESOURCE(IDI_MAIN),
IMAGE_ICON,
GetSystemMetrics(SM_CXICON) * 2,
GetSystemMetrics(SM_CYICON) * 2,
0);
if(NULL != hAppIco)
{
SendDlgItemMessage(hwndDlg, IDC_APP_ICON, STM_SETICON,
(WPARAM) hAppIco, 0);
}
SendDlgItemMessage(hwndDlg, IDC_LICTEXT, WM_SETFONT,
(WPARAM)GetStockObject(SYSTEM_FIXED_FONT), (LPARAM)TRUE);
SetDlgItemText(hwndDlg, IDC_APP_NAME, lpProjectName);
SetDlgItemText(hwndDlg, IDC_APP_DESC, lpProjectDesc);
SetDlgItemText(hwndDlg, IDC_APP_VER, lpProjectVer);
SetDlgItemText(hwndDlg, IDC_APP_GIT, lpProjectGit);
SetDlgItemText(hwndDlg, IDC_APP_AUTHOR, lpProjectAuthor);
SetDlgItemText(hwndDlg, IDC_LICTEXT, lpProjectLic);
SetFocus(GetDlgItem(hwndDlg, IDOK));
return TRUE;
}
case WM_DESTROY:
{
HICON hIcon;
/* Destroy icon */
hIcon = (HICON)SendDlgItemMessage(hwndDlg, IDC_APP_ICON, STM_GETICON,
0, 0);
if(NULL != hIcon)
{
DestroyIcon(hIcon);
}
return TRUE;
}
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case NM_CLICK:
case NM_RETURN:
switch (((LPNMHDR)lParam)->idFrom)
{
case IDC_GET_LATEST:
ShellExecute(NULL, TEXT("open"), lpProjectWeb, NULL,
NULL, SW_SHOW);
return TRUE;
case IDC_MAILTO:
ShellExecute(NULL, TEXT("open"),
TEXT("mailto:") TEXT(PROJECT_MAIL)
TEXT("?subject=") TEXT(PROJECT_NAME), NULL,
NULL, SW_SHOW);
return TRUE;
}
break;
}
return FALSE;
case WM_COMMAND:
{
switch (HIWORD(wParam))
{
case 0:
switch (LOWORD(wParam))
{
case IDOK:
case IDCANCEL:
EndDialog(hwndDlg, LOWORD(wParam));
return TRUE;
case IDC_GET_LATEST:
return TRUE;
}
}
}
}
return FALSE;
}
/******************************************************************************/
VOID ShowAboutDialog(
HWND hwndParent
)
{
DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_ABOUT),
hwndParent, AboutProc);
}