X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/2979718aac984b9456d093e4a4b6c81952942691..9ec95c23db58dac88a48fae594ea978c148d1c61:/winmisc.c diff --git a/winmisc.c b/winmisc.c index caafd7d7..916e9885 100644 --- a/winmisc.c +++ b/winmisc.c @@ -47,6 +47,7 @@ int SaneDialogBox(HINSTANCE hinst, MSG msg; int flags; int ret; + int gm; wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW; wc.lpfnWndProc = DefDlgProc; @@ -65,7 +66,7 @@ int SaneDialogBox(HINSTANCE hinst, SetWindowLong(hwnd, BOXFLAGS, 0); /* flags */ SetWindowLong(hwnd, BOXRESULT, 0); /* result from SaneEndDialog */ - while (GetMessage(&msg, NULL, 0, 0)) { + while ((gm=GetMessage(&msg, NULL, 0, 0)) > 0) { flags=GetWindowLong(hwnd, BOXFLAGS); if (!(flags & DF_END) && !IsDialogMessage(hwnd, &msg)) DispatchMessage(&msg); @@ -73,6 +74,9 @@ int SaneDialogBox(HINSTANCE hinst, break; } + if (gm == 0) + PostQuitMessage(msg.wParam); /* We got a WM_QUIT, pass it on */ + ret=GetWindowLong(hwnd, BOXRESULT); DestroyWindow(hwnd); return ret;