From 428f4fe793688a84c0bc70f8a6d35e5f802698ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Mon, 6 Feb 2017 03:00:34 +0100 Subject: Msg_Export: Fix opening/closing progress dialog --- plugins/Msg_Export/src/options.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'plugins/Msg_Export') diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 575eed291c..9a95d3c134 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -128,8 +128,8 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) INT_PTR CALLBACK __stdcall DialogProc( HWND hwndDlg, // handle to dialog box UINT uMsg, // message - WPARAM /*wParam*/, // first message parameter - LPARAM /*lParam*/ // second message parameter + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter ) { switch (uMsg) { @@ -138,6 +138,12 @@ INT_PTR CALLBACK __stdcall DialogProc( TranslateDialogDefault(hwndDlg); return TRUE; } + case WM_CLOSE: + { + if (lParam > 0) + DestroyWindow(hwndDlg); + return TRUE; + } } return FALSE; } @@ -155,7 +161,6 @@ void exportContactsMessages(void *p) HWND hProg = GetDlgItem(hDlg, IDC_EXPORT_PROGRESS); HWND hStatus = GetDlgItem(hDlg, IDC_EXP_ALL_STATUS); - ShowWindow(hDlg, SW_SHOWNORMAL); SendMessage(hProg, PBM_SETRANGE, 0, MAKELPARAM(0, data->contacts.size() - 1)); SetWindowText(hStatus, TranslateT("Reading database information (Phase 1 of 2)")); @@ -231,10 +236,9 @@ void exportContactsMessages(void *p) SendMessage(hProg, PBM_SETPOS, ++nCur, 0); RedrawWindow(hDlg, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW); - UpdateWindow(hDlg); } - DestroyWindow(hDlg); + SendMessage(hDlg, WM_CLOSE, 0, 1); } ///////////////////////////////////////////////////////////////////// @@ -293,6 +297,7 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected) // Create progress dialog HWND hDlg = data->hDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), NULL, DialogProc); + ShowWindow(hDlg, SW_SHOWNORMAL); // Process the export in other thread mir_forkthread(&exportContactsMessages, data); -- cgit v1.2.3