1*c2c66affSColin Finck #include "precomp.h"
2*c2c66affSColin Finck
3*c2c66affSColin Finck INT_PTR CALLBACK
NewDocSelDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)4*c2c66affSColin Finck NewDocSelDlgProc(HWND hDlg,
5*c2c66affSColin Finck UINT message,
6*c2c66affSColin Finck WPARAM wParam,
7*c2c66affSColin Finck LPARAM lParam)
8*c2c66affSColin Finck {
9*c2c66affSColin Finck switch (message)
10*c2c66affSColin Finck {
11*c2c66affSColin Finck static HWND hList;
12*c2c66affSColin Finck
13*c2c66affSColin Finck case WM_INITDIALOG:
14*c2c66affSColin Finck {
15*c2c66affSColin Finck LPTSTR lpDocType;
16*c2c66affSColin Finck INT i;
17*c2c66affSColin Finck
18*c2c66affSColin Finck hList = GetDlgItem(hDlg,
19*c2c66affSColin Finck IDC_LIST);
20*c2c66affSColin Finck
21*c2c66affSColin Finck for (i = IDS_DOC_TYPE_RICH_TEXT; i <= IDS_DOC_TYPE_TEXT; i++)
22*c2c66affSColin Finck {
23*c2c66affSColin Finck if (AllocAndLoadString(&lpDocType,
24*c2c66affSColin Finck hInstance,
25*c2c66affSColin Finck i))
26*c2c66affSColin Finck {
27*c2c66affSColin Finck (void)ListBox_AddString(hList,
28*c2c66affSColin Finck lpDocType);
29*c2c66affSColin Finck LocalFree((HLOCAL)lpDocType);
30*c2c66affSColin Finck }
31*c2c66affSColin Finck }
32*c2c66affSColin Finck
33*c2c66affSColin Finck SendMessage(hList,
34*c2c66affSColin Finck LB_SETCURSEL,
35*c2c66affSColin Finck 0,
36*c2c66affSColin Finck 0);
37*c2c66affSColin Finck
38*c2c66affSColin Finck return TRUE;
39*c2c66affSColin Finck }
40*c2c66affSColin Finck
41*c2c66affSColin Finck case WM_COMMAND:
42*c2c66affSColin Finck {
43*c2c66affSColin Finck INT LbSel;
44*c2c66affSColin Finck
45*c2c66affSColin Finck if (HIWORD(wParam) == LBN_DBLCLK)
46*c2c66affSColin Finck {
47*c2c66affSColin Finck LbSel = (INT)SendMessage(hList,
48*c2c66affSColin Finck LB_GETCURSEL,
49*c2c66affSColin Finck 0,
50*c2c66affSColin Finck 0);
51*c2c66affSColin Finck EndDialog(hDlg,
52*c2c66affSColin Finck LbSel);
53*c2c66affSColin Finck return TRUE;
54*c2c66affSColin Finck }
55*c2c66affSColin Finck
56*c2c66affSColin Finck switch (LOWORD(wParam))
57*c2c66affSColin Finck {
58*c2c66affSColin Finck case IDOK:
59*c2c66affSColin Finck LbSel = (INT)SendMessage(hList,
60*c2c66affSColin Finck LB_GETCURSEL,
61*c2c66affSColin Finck 0,
62*c2c66affSColin Finck 0);
63*c2c66affSColin Finck EndDialog(hDlg,
64*c2c66affSColin Finck LbSel);
65*c2c66affSColin Finck return TRUE;
66*c2c66affSColin Finck
67*c2c66affSColin Finck case IDCANCEL:
68*c2c66affSColin Finck EndDialog(hDlg, -1);
69*c2c66affSColin Finck return TRUE;
70*c2c66affSColin Finck }
71*c2c66affSColin Finck }
72*c2c66affSColin Finck }
73*c2c66affSColin Finck
74*c2c66affSColin Finck return FALSE;
75*c2c66affSColin Finck }
76*c2c66affSColin Finck
77*c2c66affSColin Finck
78*c2c66affSColin Finck
79*c2c66affSColin Finck INT_PTR CALLBACK
AboutDialogProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)80*c2c66affSColin Finck AboutDialogProc(HWND hDlg,
81*c2c66affSColin Finck UINT message,
82*c2c66affSColin Finck WPARAM wParam,
83*c2c66affSColin Finck LPARAM lParam)
84*c2c66affSColin Finck {
85*c2c66affSColin Finck HWND hLicenseEditWnd;
86*c2c66affSColin Finck static HICON hIcon = NULL;
87*c2c66affSColin Finck static LPTSTR lpLicense = NULL;
88*c2c66affSColin Finck
89*c2c66affSColin Finck switch (message)
90*c2c66affSColin Finck {
91*c2c66affSColin Finck case WM_INITDIALOG:
92*c2c66affSColin Finck
93*c2c66affSColin Finck hIcon = LoadImage(hInstance,
94*c2c66affSColin Finck MAKEINTRESOURCE(IDI_ICON),
95*c2c66affSColin Finck IMAGE_ICON,
96*c2c66affSColin Finck 16,
97*c2c66affSColin Finck 16,
98*c2c66affSColin Finck 0);
99*c2c66affSColin Finck if (hIcon != NULL)
100*c2c66affSColin Finck {
101*c2c66affSColin Finck SendMessage(hDlg,
102*c2c66affSColin Finck WM_SETICON,
103*c2c66affSColin Finck ICON_SMALL,
104*c2c66affSColin Finck (LPARAM)hIcon);
105*c2c66affSColin Finck }
106*c2c66affSColin Finck
107*c2c66affSColin Finck hLicenseEditWnd = GetDlgItem(hDlg,
108*c2c66affSColin Finck IDC_LICENSE_EDIT);
109*c2c66affSColin Finck
110*c2c66affSColin Finck if (AllocAndLoadString(&lpLicense,
111*c2c66affSColin Finck hInstance,
112*c2c66affSColin Finck IDS_LICENSE))
113*c2c66affSColin Finck {
114*c2c66affSColin Finck SetWindowText(hLicenseEditWnd,
115*c2c66affSColin Finck lpLicense);
116*c2c66affSColin Finck }
117*c2c66affSColin Finck return TRUE;
118*c2c66affSColin Finck
119*c2c66affSColin Finck case WM_COMMAND:
120*c2c66affSColin Finck if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
121*c2c66affSColin Finck {
122*c2c66affSColin Finck LocalFree((HLOCAL)lpLicense);
123*c2c66affSColin Finck DestroyIcon(hIcon);
124*c2c66affSColin Finck EndDialog(hDlg,
125*c2c66affSColin Finck LOWORD(wParam));
126*c2c66affSColin Finck return TRUE;
127*c2c66affSColin Finck }
128*c2c66affSColin Finck
129*c2c66affSColin Finck break;
130*c2c66affSColin Finck }
131*c2c66affSColin Finck
132*c2c66affSColin Finck return FALSE;
133*c2c66affSColin Finck }
134*c2c66affSColin Finck
135