* Sync with trunk r64401.
[reactos.git] / base / applications / mscutils / servman / propsheet.c
1 /*
2 * PROJECT: ReactOS Services
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/mscutils/servman/propsheet.c
5 * PURPOSE: Property dialog box message handler
6 * COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
7 *
8 */
9
10 #include "precomp.h"
11
12 static VOID
13 InitPropSheetPage(PROPSHEETPAGE *psp,
14 PSERVICEPROPSHEET dlgInfo,
15 WORD idDlg,
16 DLGPROC DlgProc)
17 {
18 ZeroMemory(psp, sizeof(PROPSHEETPAGE));
19 psp->dwSize = sizeof(PROPSHEETPAGE);
20 psp->dwFlags = PSP_DEFAULT;
21 psp->hInstance = hInstance;
22 psp->pszTemplate = MAKEINTRESOURCE(idDlg);
23 psp->pfnDlgProc = DlgProc;
24 psp->lParam = (LPARAM)dlgInfo;
25 }
26
27 LONG APIENTRY
28 OpenPropSheet(PMAIN_WND_INFO Info)
29 {
30 PROPSHEETHEADER psh;
31 PROPSHEETPAGE psp[2];
32 PSERVICEPROPSHEET pServicePropSheet;
33 LONG Ret = 0;
34
35 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
36 psh.dwSize = sizeof(PROPSHEETHEADER);
37 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USECALLBACK;// | PSH_MODELESS;
38 psh.hwndParent = Info->hMainWnd;
39 psh.hInstance = hInstance;
40 psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SM_ICON));
41 psh.pszCaption = Info->pCurrentService->lpDisplayName;
42 psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
43 psh.nStartPage = 0;
44 psh.ppsp = psp;
45
46
47 pServicePropSheet = HeapAlloc(ProcessHeap,
48 0,
49 sizeof(*pServicePropSheet));
50 if (pServicePropSheet)
51 {
52 /* save current service, as it could change while the dialog is open */
53 pServicePropSheet->pService = Info->pCurrentService;
54 pServicePropSheet->Info = Info;
55
56 InitPropSheetPage(&psp[0], pServicePropSheet, IDD_DLG_GENERAL, GeneralPageProc);
57 //InitPropSheetPage(&psp[1], Info, IDD_DLG_GENERAL, LogonPageProc);
58 //InitPropSheetPage(&psp[2], Info, IDD_DLG_GENERAL, RecoveryPageProc);
59 InitPropSheetPage(&psp[1], pServicePropSheet, IDD_DLG_DEPEND, DependenciesPageProc);
60
61 Ret = (LONG)(PropertySheet(&psh) != -1);
62
63 HeapFree(ProcessHeap,
64 0,
65 pServicePropSheet);
66 }
67
68 return Ret;
69 }