Newsgroups: comp.os.msdos.programmer
Path: utzoo!utgpu!watserv1!maytag!aftermath!water!nmouawad
From: nmouawad@water.waterloo.edu (Naji Mouawad)
Subject: Re: Need help:Ctrl-C and Ctrl-Break
Message-ID: <1990Jul31.023745.1116@water.waterloo.edu>
Sender: nmouawad@water.uwaterloo.edu. (Naji Mouawad).
Organization: University of Waterloo
References: <1990Jul30.182430.7493@uokmax.uucp> <9627@tekigm2.MEN.TEK.COM>
Date: Tue, 31 Jul 90 02:37:45 GMT
Lines: 37

In article <9627@tekigm2.MEN.TEK.COM> dennisw@tekigm2.MEN.TEK.COM (Dennis G
Ward) writes:

>I've got a truly great program underway, but I can't stand to let the
>user break out of it with Ctrl-C or Ctrl-Break, and I need keyboard
>input.  What's the trick(s)?
>-- 
>Dennis Ward    dennisw@tekigm2.MEN.TEK.COM    C1-820    (206)253-5428

The best method I know of, is to trap interrupt 09h. Write a little routine
that does the following:
   -checks if the scan code of a key corresponds to the break key or 
    the key with letter 'C'. The scan code, in case you don't know is
    the number that the keyboard processor sends, each time a key is pressed.
    These are listed in several books.
   -If that's not the case, jump to the adress of the interrupt 9h.
   -if it is, check the state of the Ctrl key (bit number 4 I think of byte
    0:40H, again you can find this info in Peter Norton's book or the
    Programmer's Solver etc.) If Ctrl is down, ignore the key and exist, if
    it's up pass it onto the old interrupt 09h.

Prefix interrupt 09 with this routine. That is set the address of interrupt 09h to the Segment:offset of
your routine. 

In C and Pascal there are various ways of replacing an interrupt.
You can also take a look at any resident utility in PC Mag. They do it all
the time.

Maybe C or Pascal has a simple function to do so, I don't remember.

Good Luck.

-- 
         ---------------+-------------------------------------------
        | Naji Mouawad  |       nmouawad@water.uwaterloo.edu        |
        |  University   |-------------------------------------------|
        | Of Waterloo   | "Thanks God, we cannot prove He Exists."  |
