Welcome!

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

SignUp Now!

Question about Ctrl events

May
12,845
164
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.
 
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.
 
---- 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

Back
Top