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-2017 Ged Murphy <gedmurphy@reactos.org>
12 unsigned int __stdcall
PropSheetThread(void* Param
);
15 InitPropSheetPage(PROPSHEETPAGE
*psp
,
16 PSERVICEPROPSHEET dlgInfo
,
20 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
21 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
22 psp
->dwFlags
= PSP_DEFAULT
;
23 psp
->hInstance
= hInstance
;
24 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
25 psp
->pfnDlgProc
= DlgProc
;
26 psp
->lParam
= (LPARAM
)dlgInfo
;
30 OpenPropSheet(PMAIN_WND_INFO Info
)
32 PSERVICEPROPSHEET pServicePropSheet
;
35 pServicePropSheet
= HeapAlloc(ProcessHeap
,
37 sizeof(*pServicePropSheet
));
38 if (!pServicePropSheet
) return;
40 /* Set the current service in this calling thread to avoid
41 * it being updated before the thread is up */
42 pServicePropSheet
->pService
= Info
->pCurrentService
;
43 pServicePropSheet
->Info
= Info
;
45 hThread
= (HANDLE
)_beginthreadex(NULL
, 0, &PropSheetThread
, pServicePropSheet
, 0, NULL
);
53 unsigned int __stdcall
PropSheetThread(void* Param
)
55 PSERVICEPROPSHEET pServicePropSheet
;
61 pServicePropSheet
= (PSERVICEPROPSHEET
)Param
;
63 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
64 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
65 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
| PSH_MODELESS
;
66 psh
.hwndParent
= pServicePropSheet
->Info
->hMainWnd
;
67 psh
.hInstance
= hInstance
;
68 psh
.hIcon
= LoadIcon(hInstance
, MAKEINTRESOURCE(IDI_SM_ICON
));
69 psh
.pszCaption
= pServicePropSheet
->Info
->pCurrentService
->lpDisplayName
;
70 psh
.nPages
= sizeof(psp
) / sizeof(PROPSHEETPAGE
);
74 /* Initialize the tabs */
75 InitPropSheetPage(&psp
[0], pServicePropSheet
, IDD_DLG_GENERAL
, GeneralPageProc
);
76 InitPropSheetPage(&psp
[1], pServicePropSheet
, IDD_LOGON
, LogonPageProc
);
77 InitPropSheetPage(&psp
[2], pServicePropSheet
, IDD_RECOVERY
, RecoveryPageProc
);
78 InitPropSheetPage(&psp
[3], pServicePropSheet
, IDD_DLG_DEPEND
, DependenciesPageProc
);
80 hDlg
= (HWND
)PropertySheetW(&psh
);
83 /* Pump the message queue */
84 while (GetMessageW(&Msg
, NULL
, 0, 0))
86 if (!PropSheet_GetCurrentPageHwnd(hDlg
))
88 /* The user hit the ok / cancel button, pull it down */
89 EnableWindow(pServicePropSheet
->Info
->hMainWnd
, TRUE
);
93 if (!PropSheet_IsDialogMessage(hDlg
, &Msg
))
95 TranslateMessage(&Msg
);
96 DispatchMessageW(&Msg
);
101 HeapFree(GetProcessHeap(), 0, pServicePropSheet
);
103 return (hDlg
!= NULL
);