#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;
+ 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;
}
-LONG APIENTRY
+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;
- LONG Ret = 0;
+ 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_USECALLBACK;// | PSH_MODELESS;
+ psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_MODELESS;
psh.hwndParent = Info->hMainWnd;
psh.hInstance = hInstance;
psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SM_ICON));
InitPropSheetPage(&psp[2], pServicePropSheet, IDD_RECOVERY, RecoveryPageProc);
InitPropSheetPage(&psp[3], pServicePropSheet, IDD_DLG_DEPEND, DependenciesPageProc);
- Ret = (LONG)(PropertySheet(&psh) != -1);
+ 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);
+ }
- HeapFree(ProcessHeap,
- 0,
- pServicePropSheet);
+ if (PropSheet_IsDialogMessage(hDlg, &Msg) != 0)
+ {
+ TranslateMessage(&Msg);
+ DispatchMessageW(&Msg);
+ }
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, pServicePropSheet);
}
- return Ret;
+ return (hDlg != NULL);
}
+