How to? Disable TCC's internal response to Alt-F4

May 20, 2017
Years and years, I loved 4DOS/4NT/TCC for not closing the window if I hit Alt-F4; that usually was when I was closing a whole series of windows, and due to an earlier switch-to-4NT-and-back, 4NT was in the window list where I didn't expect it. So 4NT stayed open, and all was well with the world.

Then, TCC or perhaps Windows changed that behaviour at some point, and Alt-F4 would equate to sudden death.. Ever since then, I am growing sadder and sadder. Today, I once again lost a command history that was going to be turned into a batch file …

Is there a way to neuter TCC's CTRL_CLOSE_EVENT handler?


May 20, 2017
Thanks! Yes, that was Win10 1709. Windows' console control notification behaviour started changing even back when I still worked there, and from what I just saw, it went steadily downhill.

From a very quick look right now, console apps still do get a CTRL_CLOSE_EVENT from conhost (used to be from csrss). However, anything that imports from user32 no longer is considered a console app, so the conhost message loop just does the usual PostQuitMessage() and falls on its sword.

If I find the time I'll go look more closely, but for now, it would seem that I am destined for a life of bleak unhappiness :)


Scott Mintz
May 20, 2008
Solon, OH, USA
Another option is in the TakeCommand Options dialog under the Advanced tab called "Minimize on Close." Alt-F4 will just minimize the window instead of closing it. However, I believe that will only help you if you run TCC in TakeCommand and not stand-alone. But I didn't test that.
May 20, 2017
@Charles Dye -- thanks. Yes, I considered that, but the non-rectangular selection is hard to give up …

@samintz -- that option only applies to TakeCommand, as you suspected.

I think a fix would require locating the conhost window, subclassing it and handling WM_CLOSE. That sounds like an excellent way to introduce subtle bugs by modifying undocumented behaviour, so I won't even ask for this as a feature. Oh well.

My thanks to all who took the time to reply, I appreciate your help and ideas!

I've done it to Outlook ... inject a DLL and with hooks, turn SC_CLOSE into SC_MINIMIZE. And that makes Alt-F4 minimize the window.

From a plugin, you can rather easily disable the system menu's "Close" and the "X" (GetSystemMenu, GetMenuItemInfo(SC_CLOSE), and DeleteMenu(SC_CLOSE, MF_BYCOMMAND)). I have Windows 7 so I can't tell how that will affect Alt-F4.