From c85beefd3a445d56a59c3b38426cec3986746446 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Fri, 3 Dec 2010 05:42:39 +0000 Subject: Fixed Updates in some cases git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@579 4f64403b-2f21-0410-a795-97e2b3489a10 --- updater/progress_dialog.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'updater/progress_dialog.cpp') diff --git a/updater/progress_dialog.cpp b/updater/progress_dialog.cpp index 4d35bd0..74ac4ef 100644 --- a/updater/progress_dialog.cpp +++ b/updater/progress_dialog.cpp @@ -64,24 +64,27 @@ INT_PTR CALLBACK DlgProcProgress(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l return TRUE; // disable esc, enter, etc case WM_CLOSE: - PostMessage(hwndDlg, WM_QUIT, 0, 0); + DestroyWindow(hwndDlg); break; case WM_DESTROY: KillTimer(hwndDlg, ID_PROGTIMER); - Utils_SaveWindowPosition(hwndDlg,0,MODULE,"ProgressWindow"); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)0)); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)0)); + Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "ProgressWindow"); + ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); + ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); + hwndProgress = NULL; + PostQuitMessage(0); break; } return FALSE; } -void ProgressWindowThread(void *) +void ProgressWindowThread(HANDLE hEvent) { hwndProgress = CreateDialog(hInst, MAKEINTRESOURCE(IDD_PROGRESS), NULL, DlgProcProgress); SetWindowPos(hwndProgress, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW); UpdateWindow(hwndProgress); + SetEvent(hEvent); MSG hwndMsg; while (GetMessage(&hwndMsg, NULL, 0, 0) > 0 && !Miranda_Terminated()) @@ -92,17 +95,17 @@ void ProgressWindowThread(void *) DispatchMessage(&hwndMsg); } } - - if (hwndProgress) DestroyWindow(hwndProgress); - hwndProgress = NULL; } void CreateProgressWindow(void) { - mir_forkthread(ProgressWindowThread, NULL); + HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + mir_forkthread(ProgressWindowThread, hEvent); + WaitForSingleObject(hEvent, INFINITE); + CloseHandle(hEvent); } void ProgressWindowDone(void) { - PostMessage(hwndProgress, WM_QUIT, 0, 0); + if (hwndProgress) PostMessage(hwndProgress, WM_CLOSE, 0, 0); } -- cgit v1.2.3