Thanks for your comments. Your suggestion has indeed been discussed before.

It is not possible to implement what you are suggesting because the scripting language is tied directly into the GUI. If a GUI event is triggered, the scripting language must be triggered immediately because GUI events must be processed at the moment that Windows sends them.

If a PeekMessage() (or any API is called that allows Windows messages to "breathe") is called (which is something that was done some versions ago for Control+Break and was reverted due to this exact issue) this causes Windows messages to be processed, resulting in the above issue.

There is no way to trigger a script immediately if one is already running as that would then lead into the far more complex issue of running multiple scripts simultaneously. This is not possible because the scripting language was intended to be single-threaded.

Multi-threading requires a completely different mindset when developing software and needs to be implemented from the ground up. There is no way to retro-actively change the scripting language to be multi-threaded.

All of this means that mIRC cannot process GUI events while a script is running.

In fact, no windows events of any kind can be processed while a script is running because many of them can trigger other script events.

It is also not possible to selectively process specific windows events without causing other issues.

And this in turn means that mIRC must process Control+Break the way that it does currently.

To summarize, so that we don't go around in circles: when mIRC, a single-threaded application, is running a script, Windows freezes its GUI and prevents it from detecting whether it has focus or not. While a script is running, the only way for Control+Break to work is for mIRC to poll the keyboard state (using GetAsyncKeyState() and not Windows messages, which cannot be used due to re-entrant threading) for Control+Break, regardless of whether mIRC has focus or not, as there is no way to detect this.

I hope that answers your question.