Question about screen buffer handles

May 20, 2008
11,424
99
Syracuse, NY, USA
Typically, when TCC starts, @CONSOLEB[-1] is 19. Where does that number come from? I couldn't get it in a plugin ... tried GetStdHandle and opening "CONOUT$" ... for now, settled on expanding "%@CONSOLEB[-1]".
 
May 20, 2008
11,424
99
Syracuse, NY, USA
It's the current console output handle. It comes from CreateFile( _TEXT("CONOUT$"), (GENERIC_READ | GENERIC_WRITE), (FILE_SHARE_READ | FILE_SHARE_WRITE), &sa, OPEN_EXISTING, 0, NULL );

And you should never try to access it directly.
I tried that but with a NULL security descriptor. I suppose that's why I wasn't getting 19. I wouldn't use it, except inside @CONSOLEB. I found out (the hard way) that if TCC starts a program in the same console and that program switches to an alternative buffer and exits without switching back to its startup buffer, the parent TCC is in never_never_land. Try it ...
Code:
start /b /w /k echo %%@consoleb[0]
... then just EXIT the started instance.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Tough (?) programming question Plugins 5
vefatica Question for someone with sysutils and Windows 10 Plugins 4
vefatica Question for Rex Plugins 1
Charles Dye SearchPaths() question Plugins 4
vefatica Question for Rex Plugins 0
Charles Dye A weirdoid plugin question Plugins 6
Charles Dye Keystroke plugins question Plugins 7
vefatica A question for Rex Plugins 5
S How to? SafeChars.dll question Plugins 4
Charles Dye Binary buffers question Plugins 0
M Just a curiosity question related to the "default" set of re-mapped characters... Plugins 2
vefatica Question about Ctrl events Plugins 2
vefatica Generic programming question Plugins 2
vefatica Compiler question Plugins 8
vefatica Plugin keyhandler observation/question Plugins 15
vefatica PLUGININFO question Plugins 9
vefatica Plugin keyhandler question Plugins 1
vefatica Pipe question Plugins 6
vefatica Code page question Plugins 2
vefatica Unicode question (revisited, question for Rex) Plugins 0
vefatica Sprintf question Plugins 1
vefatica Unicode question Plugins 13
vefatica Question about GetToken() Plugins 7
vefatica Plugin question Plugins 3
vefatica Another Sscanf question Plugins 1
vefatica NthArgument() question Plugins 1
vefatica Ctrl handling question Plugins 8
vefatica Message pumping question Plugins 12
vefatica How big is a plugin's parameter buffer? Plugins 5
vefatica Size of buffer passed to f_FUNCTION? Plugins 4

Similar threads