mirror of
https://github.com/reactos/reactos.git
synced 2024-07-21 11:48:04 +00:00
ceb1e0b9ff
[SERVMAN] - Make the property sheets modeless so users can open multiple services at the same time - Untested in ros. In fact we have no code or tests cases to check that modeless property sheets work, so please raise a bug if you find any issues with the app. - Dedicated to reactosfanboy
105 lines
3.1 KiB
C
105 lines
3.1 KiB
C
/*
|
|
* PROJECT: ReactOS Services
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
* FILE: base/applications/mscutils/servman/propsheet.c
|
|
* PURPOSE: Property dialog box message handler
|
|
* COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
|
|
*
|
|
*/
|
|
|
|
#include "precomp.h"
|
|
|
|
unsigned int __stdcall PropSheetThread(void* Param);
|
|
|
|
static VOID
|
|
InitPropSheetPage(PROPSHEETPAGE *psp,
|
|
PSERVICEPROPSHEET dlgInfo,
|
|
WORD idDlg,
|
|
DLGPROC DlgProc)
|
|
{
|
|
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
|
|
psp->dwSize = sizeof(PROPSHEETPAGE);
|
|
psp->dwFlags = PSP_DEFAULT;
|
|
psp->hInstance = hInstance;
|
|
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
|
|
psp->pfnDlgProc = DlgProc;
|
|
psp->lParam = (LPARAM)dlgInfo;
|
|
}
|
|
|
|
VOID
|
|
OpenPropSheet(PMAIN_WND_INFO Info)
|
|
{
|
|
HANDLE hThread;
|
|
hThread = (HANDLE)_beginthreadex(NULL, 0, &PropSheetThread, Info, 0, NULL);
|
|
if (hThread)
|
|
{
|
|
CloseHandle(hThread);
|
|
}
|
|
}
|
|
|
|
|
|
unsigned int __stdcall PropSheetThread(void* Param)
|
|
{
|
|
PROPSHEETHEADER psh;
|
|
PROPSHEETPAGE psp[4];
|
|
PSERVICEPROPSHEET pServicePropSheet;
|
|
HWND hDlg = NULL;
|
|
MSG Msg;
|
|
|
|
PMAIN_WND_INFO Info = (PMAIN_WND_INFO)Param;
|
|
|
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_MODELESS;
|
|
psh.hwndParent = Info->hMainWnd;
|
|
psh.hInstance = hInstance;
|
|
psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SM_ICON));
|
|
psh.pszCaption = Info->pCurrentService->lpDisplayName;
|
|
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
|
psh.nStartPage = 0;
|
|
psh.ppsp = psp;
|
|
|
|
|
|
pServicePropSheet = HeapAlloc(ProcessHeap,
|
|
0,
|
|
sizeof(*pServicePropSheet));
|
|
if (pServicePropSheet)
|
|
{
|
|
/* Save current service, as it could change while the dialog is open */
|
|
pServicePropSheet->pService = Info->pCurrentService;
|
|
pServicePropSheet->Info = Info;
|
|
|
|
InitPropSheetPage(&psp[0], pServicePropSheet, IDD_DLG_GENERAL, GeneralPageProc);
|
|
InitPropSheetPage(&psp[1], pServicePropSheet, IDD_LOGON, LogonPageProc);
|
|
InitPropSheetPage(&psp[2], pServicePropSheet, IDD_RECOVERY, RecoveryPageProc);
|
|
InitPropSheetPage(&psp[3], pServicePropSheet, IDD_DLG_DEPEND, DependenciesPageProc);
|
|
|
|
hDlg = (HWND)PropertySheetW(&psh);
|
|
if (hDlg)
|
|
{
|
|
/* Pump the message queue */
|
|
while (GetMessageW(&Msg, NULL, 0, 0))
|
|
{
|
|
|
|
if (PropSheet_GetCurrentPageHwnd(hDlg) == NULL)
|
|
{
|
|
/* The user hit the ok / cancel button, pull it down */
|
|
EnableWindow(Info->hMainWnd, TRUE);
|
|
DestroyWindow(hDlg);
|
|
}
|
|
|
|
if (PropSheet_IsDialogMessage(hDlg, &Msg) != 0)
|
|
{
|
|
TranslateMessage(&Msg);
|
|
DispatchMessageW(&Msg);
|
|
}
|
|
}
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, pServicePropSheet);
|
|
}
|
|
|
|
return (hDlg != NULL);
|
|
}
|
|
|