Unmodalize Dialogs (Make Modal Dialogs Non-Modal)

Harrymc pointed out, that AutoHotKey might be able to unmodalize windows, which lead me to this question that contained the following AHK script (with a minor syntax error which was fixed in below version):

^e::
MouseGetPos,,, WindowUnderMouse
WinSet, Style, -0x8000000, ahk_id %WindowUnderMouse%
return

With AutoHotKey installed, save this script in a file.ahk, double click the file (or right-click and select Run Script). If you have a modal dialog and want to interact with its parent/background windows, hover the mouse over the parent/background window and press CtrlE (that's what ^e::) stands for; the background/parent window should now react to interaction again without closing the modal dialog.

The "styles" are documented here. -0x8000000 is documented as

WS_DISABLED | 0x8000000 | +/-Disabled. Creates a window that is initially disabled.


Modal dialogs are used for two main purposes:

  1. Get user parameters.
    An example here is text editor's Open dialog for the file to edit.

  2. Warning/question before continuing.
    A famous example here is the Windows Update dialog asking for permission to restart Windows.

I understand you are asking for ways to automate answering/clicking specific dialogs, since I don't see a general answer. Using a tool that will, for example, click the OK button of every dialog is a sure way to disaster.

Tools may exist for specific dialogs, meaning dialogs that are identified by their title and/or originating process. You could either try existing tools, or very easily build your own using a product such as AutoHotkey together with Spy++ to inspect the given dialog's elements.

For the first case, you could perhaps use a tool such as LastPass to fill a dialog's fields with remembered values.

For the second case, a AutoHotkey script is the best tool. You may also have a look at the Microsoft 2008 article Enabling Default Reply, which details a registry entry that causes the intercept of every MessageBox function with automatically choosing the default button (I don't know if it still works in Windows 10 and have no motivation to try).

I can't think of any other useful case.

Note that my analysis above was in the direction of letting the program work in a normal manner, rather than by brute-force converting some or all modal dialogs to modless. This is because in all the programs I ever created, I cannot conceive of any program continuing correctly once a modal dialog did not block its originating thread.