Add the 'Date and Time' page.
[reactos.git] / reactos / lib / syssetup / wizard.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2004 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id: wizard.c,v 1.10 2004/11/02 15:42:09 ekohl Exp $
20 *
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS system libraries
23 * PURPOSE: System setup
24 * FILE: lib/syssetup/wizard.c
25 * PROGRAMER: Eric Kohl
26 */
27
28 /* INCLUDES *****************************************************************/
29
30 #include <windows.h>
31 #include <commctrl.h>
32
33 #include <string.h>
34 #include <tchar.h>
35 #include <setupapi.h>
36
37 #include <syssetup.h>
38
39
40 #include "globals.h"
41 #include "resource.h"
42
43
44 /* GLOBALS ******************************************************************/
45
46 static SETUPDATA SetupData;
47
48
49 /* FUNCTIONS ****************************************************************/
50
51 static VOID
52 CenterWindow(HWND hWnd)
53 {
54 HWND hWndParent;
55 RECT rcParent;
56 RECT rcWindow;
57
58 hWndParent = GetParent(hWnd);
59 if (hWndParent == NULL)
60 hWndParent = GetDesktopWindow();
61
62 GetWindowRect(hWndParent, &rcParent);
63 GetWindowRect(hWnd, &rcWindow);
64
65 SetWindowPos(hWnd,
66 HWND_TOP,
67 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
68 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
69 0,
70 0,
71 SWP_NOSIZE);
72 }
73
74
75 static HFONT
76 CreateTitleFont(VOID)
77 {
78 NONCLIENTMETRICS ncm;
79 LOGFONT LogFont;
80 HDC hdc;
81 INT FontSize;
82 HFONT hFont;
83
84 ncm.cbSize = sizeof(NONCLIENTMETRICS);
85 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
86
87 LogFont = ncm.lfMessageFont;
88 LogFont.lfWeight = FW_BOLD;
89 _tcscpy(LogFont.lfFaceName, TEXT("MS Shell Dlg"));
90
91 hdc = GetDC(NULL);
92 FontSize = 12;
93 LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72;
94 hFont = CreateFontIndirect(&LogFont);
95 ReleaseDC(NULL, hdc);
96
97 return hFont;
98 }
99
100
101 INT_PTR CALLBACK
102 WelcomeDlgProc(HWND hwndDlg,
103 UINT uMsg,
104 WPARAM wParam,
105 LPARAM lParam)
106 {
107 switch (uMsg)
108 {
109 case WM_INITDIALOG:
110 {
111 PSETUPDATA SetupData;
112 HWND hwndControl;
113 DWORD dwStyle;
114
115 /* Get pointer to the global setup data */
116 SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
117
118 hwndControl = GetParent(hwndDlg);
119
120 /* Center the wizard window */
121 CenterWindow (hwndControl);
122
123 /* Hide the system menu */
124 dwStyle = GetWindowLong(hwndControl, GWL_STYLE);
125 SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
126
127 /* Hide and disable the 'Cancel' button */
128 hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
129 ShowWindow (hwndControl, SW_HIDE);
130 EnableWindow (hwndControl, FALSE);
131
132 /* Set title font */
133 SendDlgItemMessage(hwndDlg,
134 IDC_WELCOMETITLE,
135 WM_SETFONT,
136 (WPARAM)SetupData->hTitleFont,
137 (LPARAM)TRUE);
138 }
139 break;
140
141
142 case WM_NOTIFY:
143 {
144 LPNMHDR lpnm = (LPNMHDR)lParam;
145
146 switch (lpnm->code)
147 {
148 case PSN_SETACTIVE:
149 /* Enable the Next button */
150 PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
151 break;
152
153 default:
154 break;
155 }
156 }
157 break;
158
159 default:
160 break;
161 }
162
163 return FALSE;
164 }
165
166
167 INT_PTR CALLBACK
168 OwnerPageDlgProc(HWND hwndDlg,
169 UINT uMsg,
170 WPARAM wParam,
171 LPARAM lParam)
172 {
173 TCHAR OwnerName[51];
174 TCHAR OwnerOrganization[51];
175 HKEY hKey;
176 LPNMHDR lpnm;
177
178 switch (uMsg)
179 {
180 case WM_INITDIALOG:
181 {
182 SendDlgItemMessage(hwndDlg, IDC_OWNERNAME, EM_LIMITTEXT, 50, 0);
183 SendDlgItemMessage(hwndDlg, IDC_OWNERORGANIZATION, EM_LIMITTEXT, 50, 0);
184
185 /* Set focus to owner name */
186 SetFocus(GetDlgItem(hwndDlg, IDC_OWNERNAME));
187 }
188 break;
189
190
191 case WM_NOTIFY:
192 {
193 lpnm = (LPNMHDR)lParam;
194
195 switch (lpnm->code)
196 {
197 case PSN_SETACTIVE:
198 /* Enable the Back and Next buttons */
199 PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
200 break;
201
202 case PSN_WIZNEXT:
203 OwnerName[0] = 0;
204 if (GetDlgItemText(hwndDlg, IDC_OWNERNAME, OwnerName, 50) == 0)
205 {
206 MessageBox(hwndDlg,
207 _T("Setup cannot continue until you enter your name."),
208 _T("ReactOS Setup"),
209 MB_ICONERROR | MB_OK);
210 SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
211 return TRUE;
212 }
213
214 OwnerOrganization[0] = 0;
215 GetDlgItemText(hwndDlg, IDC_OWNERORGANIZATION, OwnerOrganization, 50);
216
217 RegOpenKeyEx(HKEY_LOCAL_MACHINE,
218 _T("Software\\Microsoft\\Windows NT\\CurrentVersion"),
219 0,
220 KEY_ALL_ACCESS,
221 &hKey);
222 /* FIXME: check error code */
223
224 RegSetValueEx(hKey,
225 _T("RegisteredOwner"),
226 0,
227 REG_SZ,
228 OwnerName,
229 (_tcslen(OwnerName) + 1) * sizeof(TCHAR));
230 /* FIXME: check error code */
231
232 RegSetValueEx(hKey,
233 _T("RegisteredOrganization"),
234 0,
235 REG_SZ,
236 OwnerOrganization,
237 (_tcslen(OwnerOrganization) + 1) * sizeof(TCHAR));
238 /* FIXME: check error code */
239
240 RegCloseKey(hKey);
241 break;
242
243 default:
244 break;
245 }
246 }
247 break;
248
249 default:
250 break;
251 }
252
253 return FALSE;
254 }
255
256
257 INT_PTR CALLBACK
258 ComputerPageDlgProc(HWND hwndDlg,
259 UINT uMsg,
260 WPARAM wParam,
261 LPARAM lParam)
262 {
263 TCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
264 TCHAR Password1[15];
265 TCHAR Password2[15];
266 DWORD Length;
267 LPNMHDR lpnm;
268
269 switch (uMsg)
270 {
271 case WM_INITDIALOG:
272 {
273 /* Retrieve current computer name */
274 Length = MAX_COMPUTERNAME_LENGTH + 1;
275 GetComputerName(ComputerName, &Length);
276
277 /* Display current computer name */
278 SetDlgItemText(hwndDlg, IDC_COMPUTERNAME, ComputerName);
279
280 /* Set text limits */
281 SendDlgItemMessage(hwndDlg, IDC_COMPUTERNAME, EM_LIMITTEXT, 64, 0);
282 SendDlgItemMessage(hwndDlg, IDC_ADMINPASSWORD1, EM_LIMITTEXT, 14, 0);
283 SendDlgItemMessage(hwndDlg, IDC_ADMINPASSWORD2, EM_LIMITTEXT, 14, 0);
284
285 /* Set focus to computer name */
286 SetFocus(GetDlgItem(hwndDlg, IDC_COMPUTERNAME));
287 }
288 break;
289
290
291 case WM_NOTIFY:
292 {
293 lpnm = (LPNMHDR)lParam;
294
295 switch (lpnm->code)
296 {
297 case PSN_SETACTIVE:
298 /* Enable the Back and Next buttons */
299 PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
300 break;
301
302 case PSN_WIZNEXT:
303 if (GetDlgItemText(hwndDlg, IDC_COMPUTERNAME, ComputerName, 64) == 0)
304 {
305 MessageBox(hwndDlg,
306 _T("Setup cannot continue until you enter the name of your computer."),
307 _T("ReactOS Setup"),
308 MB_ICONERROR | MB_OK);
309 SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
310 return TRUE;
311 }
312
313 /* FIXME: check computer name for invalid characters */
314
315 if (!SetComputerName(ComputerName))
316 {
317 MessageBox(hwndDlg,
318 _T("Setup failed to set the computer name."),
319 _T("ReactOS Setup"),
320 MB_ICONERROR | MB_OK);
321 SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
322 return TRUE;
323 }
324
325 /* Check admin passwords */
326 GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD1, Password1, 15);
327 GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD2, Password2, 15);
328 if (_tcscmp(Password1, Password2))
329 {
330 MessageBox(hwndDlg,
331 _T("The passwords you entered do not match. Please enter "\
332 "the desired password again."),
333 _T("ReactOS Setup"),
334 MB_ICONERROR | MB_OK);
335 SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
336 return TRUE;
337 }
338
339 /* FIXME: check password for invalid characters */
340
341 /* FIXME: Set admin password */
342 break;
343
344 default:
345 break;
346 }
347 }
348 break;
349
350 default:
351 break;
352 }
353
354 return FALSE;
355 }
356
357
358 static VOID
359 SetKeyboardLayoutName(HWND hwnd)
360 {
361 #if 0
362 WCHAR szLayoutPath[256];
363 WCHAR szLocaleName[32];
364 DWORD dwLocaleSize;
365 HKEY hKey;
366
367 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
368 L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Locale",
369 0,
370 KEY_ALL_ACCESS,
371 &hKey))
372 return;
373
374 dwValueSize = 16 * sizeof(WCHAR);
375 if (RegQueryValueExW(hKey,
376 NULL,
377 NULL,
378 NULL,
379 szLocaleName,
380 &dwLocaleSize))
381 {
382 RegCloseKey(hKey);
383 return;
384 }
385
386 wcscpy(szLayoutPath,
387 L"SYSTEM\\CurrentControlSet\\Control\\KeyboardLayouts\\"
388 wcscat(szLayoutPath,
389 szLocaleName);
390
391 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
392 szLayoutPath,
393 0,
394 KEY_ALL_ACCESS,
395 &hKey))
396 return;
397
398 dwValueSize = 32 * sizeof(WCHAR);
399 if (RegQueryValueExW(hKey,
400 L"Layout Text",
401 NULL,
402 NULL,
403 szLocaleName,
404 &dwLocaleSize))
405 {
406 RegCloseKey(hKey);
407 return;
408 }
409
410 RegCloseKey(hKey);
411 #endif
412 }
413
414 static VOID
415 RunLocalePage(VOID)
416 {
417 PROPSHEETPAGE psp;
418 PROPSHEETHEADER psh;
419 HMODULE hDll;
420 // TCHAR Caption[256];
421
422 hDll = LoadLibraryW(L"intl.cpl");
423
424 ZeroMemory(&psp, sizeof(PROPSHEETPAGE));
425 psp.dwSize = sizeof(PROPSHEETPAGE);
426 psp.dwFlags = PSP_DEFAULT;
427 psp.hInstance = hDll;
428 psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
429 psp.pfnDlgProc = GetProcAddress(hDll, "LocalePageProc");
430
431
432 // LoadString(hDll, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
433
434 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
435 psh.dwSize = sizeof(PROPSHEETHEADER);
436 psh.dwFlags = PSH_PROPSHEETPAGE; // | PSH_PROPTITLE;
437 psh.hwndParent = NULL;
438 psh.hInstance = hDll;
439 // psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
440 // psh.pszCaption = Caption;
441 psh.nPages = 1;
442 psh.nStartPage = 0;
443 psh.ppsp = &psp;
444
445 PropertySheet(&psh);
446
447 FreeLibrary(hDll);
448 }
449
450
451 INT_PTR CALLBACK
452 LocalePageDlgProc(HWND hwndDlg,
453 UINT uMsg,
454 WPARAM wParam,
455 LPARAM lParam)
456 {
457 PSETUPDATA SetupData;
458
459 /* Retrieve pointer to the global setup data */
460 SetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
461
462 switch (uMsg)
463 {
464 case WM_INITDIALOG:
465 {
466 /* Save pointer to the global setup data */
467 SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
468 SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)SetupData);
469
470
471 SetKeyboardLayoutName(GetDlgItem(hwndDlg, IDC_LAYOUTTEXT));
472
473 }
474 break;
475
476 case WM_COMMAND:
477 if (HIWORD(wParam) == BN_CLICKED)
478 {
479 switch (LOWORD(wParam))
480 {
481 case IDC_CUSTOMLOCALE:
482 {
483 RunLocalePage();
484 }
485 break;
486 }
487 }
488 break;
489
490 case WM_NOTIFY:
491 {
492 LPNMHDR lpnm = (LPNMHDR)lParam;
493
494 switch (lpnm->code)
495 {
496 case PSN_SETACTIVE:
497 /* Enable the Back and Next buttons */
498 PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
499 break;
500
501 case PSN_WIZNEXT:
502 break;
503
504 default:
505 break;
506 }
507 }
508 break;
509
510 default:
511 break;
512 }
513
514 return FALSE;
515 }
516
517
518 static VOID
519 InitTimeZoneList(HWND hwnd)
520 {
521 WCHAR szKeyName[256];
522 WCHAR szValue[256];
523 DWORD dwIndex;
524 DWORD dwNameSize;
525 DWORD dwValueSize;
526 LONG lError;
527 HKEY hZonesKey;
528 HKEY hZoneKey;
529
530 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
531 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones",
532 0,
533 KEY_ALL_ACCESS,
534 &hZonesKey))
535 return;
536
537 dwIndex = 0;
538 while (TRUE)
539 {
540 dwNameSize = 256;
541 lError = RegEnumKeyExW(hZonesKey,
542 dwIndex,
543 szKeyName,
544 &dwNameSize,
545 NULL,
546 NULL,
547 NULL,
548 NULL);
549 if (lError != ERROR_SUCCESS && lError != ERROR_MORE_DATA)
550 break;
551
552 if (RegOpenKeyExW(hZonesKey,
553 szKeyName,
554 0,
555 KEY_ALL_ACCESS,
556 &hZoneKey))
557 break;
558
559 dwValueSize = 256 * sizeof(WCHAR);
560 if (RegQueryValueExW(hZoneKey,
561 L"Display",
562 NULL,
563 NULL,
564 (LPBYTE)szValue,
565 &dwValueSize))
566 {
567 RegCloseKey(hZoneKey);
568 break;
569 }
570
571 SendMessageW(hwnd,
572 CB_ADDSTRING,
573 0,
574 (LPARAM)szValue);
575
576 RegCloseKey(hZoneKey);
577
578 dwIndex++;
579 }
580
581 RegCloseKey(hZonesKey);
582
583 SendMessageW(hwnd,
584 CB_SETCURSEL,
585 (WPARAM)0, // index
586 0);
587
588 #if 0
589 SendMessage(hwnd,
590 CB_ADDSTRING,
591 0,
592 (LPARAM)"Test0");
593 SendMessage(hwnd,
594 CB_ADDSTRING,
595 0,
596 (LPARAM)"Test1");
597 SendMessage(hwnd,
598 CB_ADDSTRING,
599 0,
600 (LPARAM)"Test2");
601 SendMessage(hwnd,
602 CB_ADDSTRING,
603 0,
604 (LPARAM)"Test3");
605
606 SendMessage(hwnd,
607 CB_SETCURSEL,
608 (WPARAM)0, // index
609 0);
610 #endif
611 }
612
613
614 static VOID
615 SetLocalDateTime(HWND hwnd)
616 {
617 SYSTEMTIME Date;
618 SYSTEMTIME Time;
619 SYSTEMTIME SystemTime;
620
621 if (DateTime_GetSystemTime(GetDlgItem(hwnd, IDC_DATEPICKER), &Date) == GDT_VALID)
622 {
623 if (DateTime_GetSystemTime(GetDlgItem(hwnd, IDC_TIMEPICKER), &Time) == GDT_VALID)
624 {
625 SystemTime.wYear = Date.wYear;
626 SystemTime.wMonth = Date.wMonth;
627 SystemTime.wDayOfWeek = Date.wDayOfWeek;
628 SystemTime.wDay = Date.wDay;
629 SystemTime.wHour = Time.wHour;
630 SystemTime.wMinute = Time.wMinute;
631 SystemTime.wSecond = Time.wSecond;
632 SystemTime.wMilliseconds = Time.wMilliseconds;
633
634 SetLocalTime(&SystemTime);
635 }
636 }
637 }
638
639
640 INT_PTR CALLBACK
641 DateTimePageDlgProc(HWND hwndDlg,
642 UINT uMsg,
643 WPARAM wParam,
644 LPARAM lParam)
645 {
646 PSETUPDATA SetupData;
647
648 /* Retrieve pointer to the global setup data */
649 SetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
650
651 switch (uMsg)
652 {
653 case WM_INITDIALOG:
654 {
655 /* Save pointer to the global setup data */
656 SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
657 SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)SetupData);
658
659 InitTimeZoneList(GetDlgItem(hwndDlg, IDC_TIMEZONELIST));
660 }
661 break;
662
663
664 case WM_NOTIFY:
665 {
666 LPNMHDR lpnm = (LPNMHDR)lParam;
667
668 switch (lpnm->code)
669 {
670 case PSN_SETACTIVE:
671 /* Enable the Back and Next buttons */
672 PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
673 break;
674
675 case PSN_WIZNEXT:
676 {
677 // SetTimeZoneInformation();
678
679 SetLocalDateTime(hwndDlg);
680 }
681 break;
682
683 default:
684 break;
685 }
686 }
687 break;
688
689 default:
690 break;
691 }
692
693 return FALSE;
694 }
695
696
697 INT_PTR CALLBACK
698 ProcessPageDlgProc(HWND hwndDlg,
699 UINT uMsg,
700 WPARAM wParam,
701 LPARAM lParam)
702 {
703 PSETUPDATA SetupData;
704
705 /* Retrieve pointer to the global setup data */
706 SetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
707
708 switch (uMsg)
709 {
710 case WM_INITDIALOG:
711 {
712 /* Save pointer to the global setup data */
713 SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
714 SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)SetupData);
715 }
716 break;
717
718 case WM_TIMER:
719 {
720 INT Position;
721 HWND hWndProgress;
722
723 hWndProgress = GetDlgItem(hwndDlg, IDC_PROCESSPROGRESS);
724 Position = SendMessage(hWndProgress, PBM_GETPOS, 0, 0);
725 if (Position == 300)
726 {
727 PropSheet_PressButton(GetParent(hwndDlg), PSBTN_NEXT);
728 }
729 else
730 {
731 SendMessage(hWndProgress, PBM_SETPOS, Position + 1, 0);
732 }
733 }
734 return TRUE;
735
736 case WM_NOTIFY:
737 {
738 LPNMHDR lpnm = (LPNMHDR)lParam;
739
740 switch (lpnm->code)
741 {
742 case PSN_SETACTIVE:
743 /* Disable the Back and Next buttons */
744 PropSheet_SetWizButtons(GetParent(hwndDlg), 0);
745
746 SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETRANGE, 0,
747 MAKELPARAM(0, 300));
748 SetTimer(hwndDlg, 0, 50, NULL);
749 break;
750
751 case PSN_WIZNEXT:
752
753 /* Enable the Back and Next buttons */
754 PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
755 break;
756
757 default:
758 break;
759 }
760 }
761 break;
762
763 default:
764 break;
765 }
766
767 return FALSE;
768 }
769
770
771
772 INT_PTR CALLBACK
773 FinishDlgProc(HWND hwndDlg,
774 UINT uMsg,
775 WPARAM wParam,
776 LPARAM lParam)
777 {
778
779 switch (uMsg)
780 {
781 case WM_INITDIALOG:
782 {
783 PSETUPDATA SetupData;
784
785 /* Get pointer to the global setup data */
786 SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
787
788 /* Set title font */
789 SendDlgItemMessage(hwndDlg,
790 IDC_FINISHTITLE,
791 WM_SETFONT,
792 (WPARAM)SetupData->hTitleFont,
793 (LPARAM)TRUE);
794 }
795 break;
796
797 case WM_NOTIFY:
798 {
799 LPNMHDR lpnm = (LPNMHDR)lParam;
800
801 switch (lpnm->code)
802 {
803 case PSN_SETACTIVE:
804 /* Enable the correct buttons on for the active page */
805 PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_FINISH);
806 break;
807
808 case PSN_WIZBACK:
809 /* Handle a Back button click, if necessary */
810 break;
811
812 case PSN_WIZFINISH:
813 /* Handle a Finish button click, if necessary */
814 break;
815
816 default:
817 break;
818 }
819 }
820 break;
821
822 default:
823 break;
824 }
825
826 return FALSE;
827 }
828
829
830 VOID
831 InstallWizard(VOID)
832 {
833 PROPSHEETHEADER psh;
834 HPROPSHEETPAGE ahpsp[6];
835 PROPSHEETPAGE psp;
836
837 /* Clear setup data */
838 ZeroMemory(&SetupData, sizeof(SETUPDATA));
839
840 /* Create the Welcome page */
841 ZeroMemory (&psp, sizeof(PROPSHEETPAGE));
842 psp.dwSize = sizeof(PROPSHEETPAGE);
843 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
844 psp.hInstance = hDllInstance;
845 psp.lParam = (LPARAM)&SetupData;
846 psp.pfnDlgProc = WelcomeDlgProc;
847 psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
848 ahpsp[0] = CreatePropertySheetPage(&psp);
849
850 /* Create the Owner page */
851 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
852 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
853 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_OWNERSUBTITLE);
854 psp.pszTemplate = MAKEINTRESOURCE(IDD_OWNERPAGE);
855 psp.pfnDlgProc = OwnerPageDlgProc;
856 ahpsp[1] = CreatePropertySheetPage(&psp);
857
858 /* Create the Computer page */
859 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
860 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_COMPUTERTITLE);
861 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_COMPUTERSUBTITLE);
862 psp.pfnDlgProc = ComputerPageDlgProc;
863 psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE);
864 ahpsp[2] = CreatePropertySheetPage(&psp);
865
866
867 /* Create the Locale page */
868 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
869 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LOCALETITLE);
870 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE);
871 psp.pfnDlgProc = LocalePageDlgProc;
872 psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
873 ahpsp[3] = CreatePropertySheetPage(&psp);
874
875
876 /* Create the DateTime page */
877 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
878 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);
879 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DATETIMESUBTITLE);
880 psp.pfnDlgProc = DateTimePageDlgProc;
881 psp.pszTemplate = MAKEINTRESOURCE(IDD_DATETIMEPAGE);
882 ahpsp[4] = CreatePropertySheetPage(&psp);
883
884
885 /* Create the Process page */
886 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
887 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE);
888 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE);
889 psp.pfnDlgProc = ProcessPageDlgProc;
890 psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
891 ahpsp[5] = CreatePropertySheetPage(&psp);
892
893
894 /* Create the Finish page */
895 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
896 psp.pfnDlgProc = FinishDlgProc;
897 psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
898 ahpsp[6] = CreatePropertySheetPage(&psp);
899
900 /* Create the property sheet */
901 psh.dwSize = sizeof(PROPSHEETHEADER);
902 psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
903 psh.hInstance = hDllInstance;
904 psh.hwndParent = NULL;
905 psh.nPages = 7;
906 psh.nStartPage = 0;
907 psh.phpage = ahpsp;
908 psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
909 psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
910
911 /* Create title font */
912 SetupData.hTitleFont = CreateTitleFont();
913
914 /* Display the wizard */
915 PropertySheet(&psh);
916
917 DeleteObject(SetupData.hTitleFont);
918 }
919
920 /* EOF */