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