BASICA: trapping ctrl-c and ctrl-break. 
Author Message
 BASICA: trapping ctrl-c and ctrl-break.

        I have a BASICA program (GWBASIC actually, same difference) that I'd
like to make able to trap ctrl-c and ctrl-break.  In other words, I'd like for
the program not to break when ctrl-c is typed at an input statement, and I'd
like the program to be able to ask the user if he/she is certain about breaking
out with ctrl-break.  I already have an error handling routine (yes, I know
about ON ERROR GOTO statements) but it doesn't seem to cover these.
        Anyone know what I'm talking about? :-)  Thanks much.
--
Matt Bernhardt
University of Georgia                Fools multiply folly.



Mon, 01 Sep 1997 22:13:09 GMT  
 BASICA: trapping ctrl-c and ctrl-break.

Quote:

>    I have a BASICA program (GWBASIC actually, same difference) that
I'd
>like to make able to trap ctrl-c and ctrl-break.  In other words, I'd
like for
>the program not to break when ctrl-c is typed at an input statement,
and I'd
>like the program to be able to ask the user if he/she is certain about
breaking
>out with ctrl-break.  I already have an error handling routine (yes, I
know
>about ON ERROR GOTO statements) but it doesn't seem to cover these.
>    Anyone know what I'm talking about? :-)  Thanks much.
>--
>Matt Bernhardt
>University of Georgia                Fools multiply folly.


Seriously, you would probibly be better off (instead of wasting hours of
your time) to just get a utility that would disable the Ctrl Key.  You
can get this program anywhere, including from PC Magazine.  Just enable
the TSR program before you start and you won't have to worry...

--Later



Tue, 02 Sep 1997 04:09:04 GMT  
 BASICA: trapping ctrl-c and ctrl-break.

Quote:


>>        I have a BASICA program (GWBASIC actually, same difference) that
>I'd
>>like to make able to trap ctrl-c and ctrl-break.  In other words, I'd
>like for
>>the program not to break when ctrl-c is typed at an input statement,
>and I'd
>>like the program to be able to ask the user if he/she is certain about
>breaking
>>out with ctrl-break.  I already have an error handling routine (yes, I
>know
>>about ON ERROR GOTO statements) but it doesn't seem to cover these.
>>        Anyone know what I'm talking about? :-)  Thanks much.
>Seriously, you would probibly be better off (instead of wasting hours of
>your time) to just get a utility that would disable the Ctrl Key.  You
>can get this program anywhere, including from PC Magazine.  Just enable
>the TSR program before you start and you won't have to worry...

        That' not an option here - the code has to execute on a variety of
computers.  I can't control the presence or absence of a TSR program.  However,
disabling the control key is a viable solution.  Any way to do this in BASICA?
--
Matt Bernhardt
University of Georgia                Fools multiply folly.



Tue, 02 Sep 1997 08:24:25 GMT  
 BASICA: trapping ctrl-c and ctrl-break.

Quote:

>         I have a BASICA program (GWBASIC actually, same difference) that I'd
> like to make able to trap ctrl-c and ctrl-break.  In other words, I'd like for
> the program not to break when ctrl-c is typed at an input statement, and I'd
> like the program to be able to ask the user if he/she is certain about breaking
> out with ctrl-break.  I already have an error handling routine (yes, I know
> about ON ERROR GOTO statements) but it doesn't seem to cover these.
>         Anyone know what I'm talking about? :-)  Thanks much.

Not sure this is possible in an interpretive environment. You _can_ turn
off Ctrl-Break checking with an interrupt call...
If the program isn't too long and complicated, you might consider porting
it to ASIC, which'll let you catch any keystrokes, AFAIR.

--
Douggie
          sig in therapy, and doing well. Just don't mention the war...



Wed, 03 Sep 1997 23:07:20 GMT  
 BASICA: trapping ctrl-c and ctrl-break.
Here is a way to disable/reenable Ctrl-Break:

' DISABLE CTRL-BREAK:                                              
' First save the current vectors:                                  
def seg=0: for i=108 to 111: brk$(i-108)=str$(peek(i)): next      
' Then poke new interrupt vectors:                                
poke 108,83: poke 109,255: poke 110,0: poke 111,240: def seg      

' RESTORE CTRL-BREAK:                                              
def seg=0: for i=108 to 111: poke i,val(brk$(i-108)): next: def seg

This assumes the creation of a 4 element string array to hold the values,
but it could easily be handled in other ways.  Good luck!

  - Foon



Wed, 03 Sep 1997 13:24:32 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Trapping CTRL+BREAK and CTRL+ALT+DEL

2. Unset ctrl-c and ctrl-break ?

3. QB CTRL-BREAK and CTRL-ALT-DEL

4. Trapping Ctrl/Alt/Del + Ctrl/Pause

5. Trapping CTRL+BREAK

6. Trapping CTRL+BREAK

7. Trapping Ctrl-Break, etc

8. Forgot how to trap Ctrl-Break in MS QBASIC

9. Trapping Ctrl+Break

10. HOW CAN I DISABLE CTRL+X, CTRL+V,CTRL+C

11. HOW CAN I DISABLE Ctrl+C,Ctrl+V,Ctrl+X

12. Ctrl+Break in VB6 breaks in calling module!

 

 
Powered by phpBB® Forum Software