[HEADERS]
[reactos.git] / reactos / 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
13 static VOID
14 InitPropSheetPage(PROPSHEETPAGE *psp,
15 PSERVICEPROPSHEET dlgInfo,
16 WORD idDlg,
17 DLGPROC DlgProc)
18 {
19 ZeroMemory(psp, sizeof(PROPSHEETPAGE));
20 psp->dwSize = sizeof(PROPSHEETPAGE);
21 psp->dwFlags = PSP_DEFAULT;
22 psp->hInstance = hInstance;
23 psp->pszTemplate = MAKEINTRESOURCE(idDlg);
24 psp->pfnDlgProc = DlgProc;
25 psp->lParam = (LPARAM)dlgInfo;
26 }
27
28
29 LONG APIENTRY
30 OpenPropSheet(PMAIN_WND_INFO Info)
31 {
32 PROPSHEETHEADER psh;
33 PROPSHEETPAGE psp[2];
34 PSERVICEPROPSHEET pServicePropSheet;
35 LONG Ret = 0;
36
37 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
38 psh.dwSize = sizeof(PROPSHEETHEADER);
39 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USECALLBACK;// | PSH_MODELESS;
40 psh.hwndParent = Info->hMainWnd;
41 psh.hInstance = hInstance;
42 psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SM_ICON));
43 psh.pszCaption = Info->pCurrentService->lpDisplayName;
44 psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
45 psh.nStartPage = 0;
46 psh.ppsp = psp;
47
48
49 pServicePropSheet = HeapAlloc(ProcessHeap,
50 0,
51 sizeof(*pServicePropSheet));
52 if (pServicePropSheet)
53 {
54 /* save current service, as it could change while the dialog is open */
55 pServicePropSheet->pService = Info->pCurrentService;
56 pServicePropSheet->Info = Info;
57
58 InitPropSheetPage(&psp[0], pServicePropSheet, IDD_DLG_GENERAL, GeneralPageProc);
59 //InitPropSheetPage(&psp[1], Info, IDD_DLG_GENERAL, LogonPageProc);
60 //InitPropSheetPage(&psp[2], Info, IDD_DLG_GENERAL, RecoveryPageProc);
61 InitPropSheetPage(&psp[1], pServicePropSheet, IDD_DLG_DEPEND, DependenciesPageProc);
62
63 Ret = (LONG)(PropertySheet(&psh) != -1);
64
65 HeapFree(ProcessHeap,
66 0,
67 pServicePropSheet);
68 }
69
70 return Ret;
71 }
72