Question about Ctrl events

May 20, 2008
11,543
104
Syracuse, NY, USA
I have an old plugin, GENBREAK, a one-liner ...

Code:
GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
It has served me well until lately. When I use it like this (pressing "q"):

Code:
ON BREAK ( ECHO foo & QUIT )
DO FOREVER
    DELAY /M 1
    SET key=0
    INKEY  %%key
    SWITCH %key
        CASE q
            GENBREAK
    ENDSWITCH
ENDDO
it's iffy whether or not I see "foo" (maybe 60/40 in favor of not seeing it). Why is it iffy? And how might I improve GENBREAK so it's reliable in this situation? Thanks.
 
May 20, 2008
11,543
104
Syracuse, NY, USA
On Thu, 28 Apr 2011 23:16:12 -0400, you wrote:

|Code:
|---------
|ON BREAK ( ECHO foo & QUIT )
|DO FOREVER
| DELAY /M 1
| SET key=0
| INKEY %%key
| SWITCH %key
| CASE q
| GENBREAK
| ENDSWITCH
|ENDDO
|---------
|it's iffy whether or not I see "foo" (maybe 60/40 in favor of not seeing it). Why is it iffy? And how might I improve GENBREAK so it's reliable in this situation? Thanks.

I should have added that the batch file always ends.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- Original Message ----
From: vefatica
...
|| it's iffy whether or not I see "foo" (maybe 60/40 in favor of not
|| seeing it). Why is it iffy? And how might I improve GENBREAK so it's
|| reliable in this situation? Thanks.
|
| I should have added that the batch file always ends.

If the batch file is run in a transient or piped-to instance of TCC, the issue could be timing: the instance disappears before the message in ECHO becomes visible, due to buffering.

Regardless, I think you could use "ON CONDITION" without the need for GENBREAK!
--
Steve
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Ctrl handling question Plugins 8
vefatica Tough (?) programming question Plugins 5
vefatica Question about screen buffer handles Plugins 2
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 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 Message pumping question Plugins 12
vefatica Plugin -> thread -> Command() -> Ctrl-C? Plugins 20

Similar threads