Skip to content

Commit

Permalink
Fix unkillable Windows message boxes (Closes #69)
Browse files Browse the repository at this point in the history
When a message box uses the Yes/No or Abort/Retry/Ignore style, it
ignores any WM_CLOSE message. We explicitly select a button to
ensure the window is closed.
  • Loading branch information
samhocevar committed May 29, 2022
1 parent 67e7b09 commit 0ea84d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion portable-file-dialogs.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Portable File Dialogs
//
// Copyright © 2018—2020 Sam Hocevar <[email protected]>
// Copyright © 2018–2022 Sam Hocevar <[email protected]>
//
// This library is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
Expand Down Expand Up @@ -598,7 +598,11 @@ inline bool internal::executor::kill()
EnumWindows(&enum_windows_callback, (LPARAM)this);
for (auto hwnd : m_windows)
if (previous_windows.find(hwnd) == previous_windows.end())
{
SendMessage(hwnd, WM_CLOSE, 0, 0);
// Also send IDNO in case of a Yes/No or Abort/Retry/Ignore messagebox
SendMessage(hwnd, WM_COMMAND, IDNO, 0);
}
}
#elif __EMSCRIPTEN__ || __NX__
// FIXME: do something
Expand Down

0 comments on commit 0ea84d6

Please sign in to comment.