2 * ReactOS New devices installation
3 * Copyright (C) 2005, 2008 ReactOS Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library 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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * PROJECT: ReactOS Add hardware control panel
21 * FILE: dll/cpl/hdwwiz/hdwwiz.c
22 * PURPOSE: ReactOS Add hardware control panel
23 * PROGRAMMER: Hervé Poussineau (hpoussin@reactos.org)
24 * Dmitry Chapyshev (dmitry@reactos.org)
40 /* GLOBALS ******************************************************************/
42 HINSTANCE hApplet
= NULL
;
45 typedef BOOL (WINAPI
*PINSTALL_NEW_DEVICE
)(HWND
, LPGUID
, PDWORD
);
49 InstallNewDevice(HWND hwndParent
, LPGUID ClassGuid
, PDWORD pReboot
)
63 ncm
.cbSize
= sizeof(NONCLIENTMETRICS
);
64 SystemParametersInfo(SPI_GETNONCLIENTMETRICS
, 0, &ncm
, 0);
66 LogFont
= ncm
.lfMessageFont
;
67 LogFont
.lfWeight
= FW_BOLD
;
68 _tcscpy(LogFont
.lfFaceName
, _T("MS Shell Dlg"));
72 LogFont
.lfHeight
= 0 - GetDeviceCaps (hdc
, LOGPIXELSY
) * FontSize
/ 72;
73 hFont
= CreateFontIndirect(&LogFont
);
79 static INT_PTR CALLBACK
80 StartPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
87 SendDlgItemMessage(hwndDlg
, IDC_FINISHTITLE
, WM_SETFONT
, (WPARAM
)hTitleFont
, (LPARAM
)TRUE
);
95 static INT_PTR CALLBACK
96 SearchPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
101 static INT_PTR CALLBACK
102 IsConnctedPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
108 if(HIWORD(wParam
) == BN_CLICKED
)
110 if ((SendDlgItemMessage(hwndDlg
, IDC_CONNECTED
, BM_GETCHECK
, 0, 0) == BST_CHECKED
) ||
111 (SendDlgItemMessage(hwndDlg
, IDC_NOTCONNECTED
, BM_GETCHECK
, 0, 0) == BST_CHECKED
))
113 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
| PSWIZB_BACK
);
117 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
125 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
131 /* Disable "Next" button */
132 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
143 static INT_PTR CALLBACK
144 FinishPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
151 SendDlgItemMessage(hwndDlg
, IDC_FINISHTITLE
, WM_SETFONT
, (WPARAM
)hTitleFont
, (LPARAM
)TRUE
);
157 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
163 /* Only "Finish" button */
164 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
);
176 HardwareWizardInit(HWND hwnd
)
178 HPROPSHEETPAGE ahpsp
[3];
179 PROPSHEETPAGE psp
= {0};
183 /* Create the Start page, until setup is working */
184 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
185 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
186 psp
.hInstance
= hApplet
;
188 psp
.pfnDlgProc
= StartPageDlgProc
;
189 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_STARTPAGE
);
190 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
192 /* Create search page */
193 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
194 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
195 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDS_SEARCHTITLE
);
196 psp
.pszHeaderSubTitle
= NULL
;
197 psp
.hInstance
= hApplet
;
199 psp
.pfnDlgProc
= SearchPageDlgProc
;
200 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_SEARCHPAGE
);
201 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
203 /* Create is connected page */
204 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
205 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
206 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDS_ISCONNECTED
);
207 psp
.pszHeaderSubTitle
= NULL
;
208 psp
.hInstance
= hApplet
;
210 psp
.pfnDlgProc
= IsConnctedPageDlgProc
;
211 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_ISCONNECTEDPAGE
);
212 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
214 /* Create finish page */
215 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
216 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
217 psp
.hInstance
= hApplet
;
219 psp
.pfnDlgProc
= FinishPageDlgProc
;
220 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_FINISHPAGE
);
221 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
223 /* Create the property sheet */
224 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
225 psh
.dwFlags
= PSH_WIZARD97
| PSH_WATERMARK
| PSH_HEADER
;
226 psh
.hInstance
= hApplet
;
227 psh
.hwndParent
= NULL
;
231 psh
.pszbmWatermark
= MAKEINTRESOURCE(IDB_WATERMARK
);
232 psh
.pszbmHeader
= MAKEINTRESOURCE(IDB_HEADER
);
234 /* Create title font */
235 hTitleFont
= CreateTitleFont();
237 /* Display the wizard */
240 DeleteObject(hTitleFont
);
244 AddHardwareWizard(HWND hwnd
, LPWSTR lpName
)
248 DPRINT1("No support of remote installation yet!\n");
252 HardwareWizardInit(hwnd
);
255 /* Control Panel Callback */
257 CPlApplet(HWND hwndCpl
,
272 CPLINFO
*CPlInfo
= (CPLINFO
*)lParam2
;
274 CPlInfo
->idIcon
= IDI_CPLICON
;
275 CPlInfo
->idName
= IDS_CPLNAME
;
276 CPlInfo
->idInfo
= IDS_CPLDESCRIPTION
;
281 AddHardwareWizard(hwndCpl
, NULL
);
290 DllMain(HINSTANCE hinstDLL
, DWORD dwReason
, LPVOID lpvReserved
)
292 UNREFERENCED_PARAMETER(lpvReserved
);
296 case DLL_PROCESS_ATTACH
: