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

May 20, 2017
22
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.
 
May 20, 2017
22
0
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 :)
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
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.
 

samintz

Scott Mintz
May 20, 2008
1,503
16
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
22
0
@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.
 
May 20, 2017
22
0
@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. :)
 
May 20, 2008
11,424
99
Syracuse, NY, USA
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
Thread starter Title Forum Replies Date
vefatica Disable extended directory searches (completely)? Support 8
WadeHatler Any way to disable ALL the global hotkeys? Support 8
T Disable audible beep on input and inkey Support 2
P Can't disable internal tar, at least in pipes Support 3
M Disable commands? Support 2
J How to? Disable unix-style paths interpretation of / Support 2
P Disable global hotkey Ctrl+Shift+T Support 19
jbarnes1967 Disable wildcard [ char in destination Support 10
S How to? enable or disable screen saver password Support 5
rconn How to disable avatars Support 10
J Disable Automatic Directory Changes? Support 6
vefatica TCC startup: /IP not honored after /K Support 1
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
C COMSPEC constantly reset to TCC.EXE Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
C How to? starting TCC/TCMD v25 Support 2
CWBillow TCC and TCMD in Powershell Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
Alpengreis Fixed Crash after copy dialog with big TCC.exception.log Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
L FTYPE in TCC, less quirky than in cmd.exe Support 3
V Set path permanently from within TCC? Support 3
DrusTheAxe Runaway TCC.exception.log filling drive Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
Joe Caverly tcc.exception.log Support 3
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
vefatica SCRIPT ... TCC disappears Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
Jesse Heines Access Denied errors in TCC 27 Support 9
fpefpe How to? tcc inifile (%_ininame) Support 3
M How to? Black TCC Prompt Support 2
D Differences between TCC and CMD with COPY /b Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
Jay Sage Extra TCC Tasks Support 6
vefatica Can I turn off the minimize to tray mechanism in TCC? Support 5
N Command execution slows down in TCC Prompt after a while Support 6
R Upgrade TCMD 19 to TCC 26 Support 1
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
samintz How to? Is this doable in TCC? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
D TCC tab detaching & restarting Support 3
Ó Recent git output not shown on TCC Support 1
P Kill all other instances of tcc from a btm batch file Support 2
L Using TCC.exe through an SSH connection Support 3
M TCC color issue in ConEmu Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
Alpengreis Python support for 3.8.3 in TCC v26.x? Support 2

Similar threads