Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

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

May
24
0
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?

Thanks,

Felix.
 
I don't think that TCC does handle Alt-F4. Are you perhaps using Windows 10, with its new console features?
 
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 :)
 
There is a tick box labeled "Use legacy console" in the console properties dialog. It disables a number of new features. You'll have to decide for yourself whether it makes life more or less bleak and unhappy.
 
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.
 
@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!

Cheers,
Felix.
 
If I remember correctly, Windows won't let you subclass the conhost window.
 
@vefatica -- depends on the level of brutality one wishes to apply. But yes, not wanting to install a driver just for this is another reason why I'll just keep sobbing into my handkerchief. :)
 
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.
 

Similar threads

Back
Top