7

Or do I have to use threads? (C++)

Vladimir
  • 191
  • 1
  • 9

2 Answers2

6

No there isn't. Alternatively, you can create a "modeless dialog box".

ChrisW
  • 54,973
  • 13
  • 116
  • 224
2

Message boxes are modal dialogs. The whole idea is that they aren't asynchronous. Assuming it was possible to do this (which it is, given the right amount of tinkering), would you want to confuse users with something that looks familiar but acts in a different way to what they expect? The question is, why do you want to do this? maybe there is a better solution.

Michael Baldry
  • 1,990
  • 2
  • 14
  • 28
  • 6
    Go into Explorer, and press `Delete` to delete any file. You will be presented with a message box, which is always-on-top, and must be dealt with. Yet **Explorer** continues to be responsive to input. You've just discovered a perfectly natural, intuitive, *"asynchronous message box"*. Now that you have justification for the question, try to answer it: Is there any way to make `MessageBox` modeless (i.e. asynchronous)? – Ian Boyd Oct 25 '13 at 19:36
  • The default [`MessageBox`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox) mode is `MB_APPLMODAL`, in which only the active thread and optionally the specified `hWnd` is blocked. Other threads/windows continue running normally, same as in Explorer. @IanBoyd – rustyx Aug 02 '19 at 20:43
  • 1
    I concede, there are cases for it. I was 9 years less wise when I wrote this answer :) – Michael Baldry Aug 09 '19 at 08:21