Article View: comp.os.msdos.programmer
Article #1735Re: Need help:Ctrl-C and Ctrl-Break
From: c/o Peter Gaal
Date: Tue, 31 Jul 1990 10:57
Date: Tue, 31 Jul 1990 10:57
43 lines
2313 bytes
2313 bytes
In article <1990Jul31.023745.1116@water.waterloo.edu>, nmouawad@water.waterloo.edu (Naji Mouawad) writes:
> In article <9627@tekigm2.MEN.TEK.COM> dennisw@tekigm2.MEN.TEK.COM (Dennis G
> Ward) writes:
>
> >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:
> ["little" deleted]
Hmm, with your suggestion, you have to do scancode processing yourself,
but why shouldn't MSDOS do the work for you ?
The following should work:
Choose a global flag variable, say c_break
Replace INT09h with the following (meta)code:
call original int09h
look if c_break is true
if yes,
get the next "keystroke" (getch() in C is ok here!), this overreads
the break scancode
reset the c_break flag
if you want, set some other flag to signal c_break was hit
else
do nothing
and complete
When the original int09h runs and detects ctrl-break or ctrl-C was pressed,
it calls one of the DOS ctrl-break handlers (int19h or int24h, but please
do not beat me if that's wrong, I have no doc handy...) which normally
set a DOS internal flag which causes DOS to terminate your program on
thenext int21h.
So the only thing which remains to do is to replace these two ctrl-break
interrupts with your own handler, simply setting the c_break flag inspected
by your own keyboard handler.
It is important NOT to call the original ctrl-break handlers from your
own, because otherwise DOS would show up with a nasty "^C" string later.
I hope I go it half right...
Bye
Patrick
Technical Details
Message-ID:
<5717@sbsvax.cs.uni-sb.de>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!yale!mintaka!bloom-beacon!eru!luth!sunic!mcsun!unido!sbsvax!fs-infoReferences:
<1990Jul30.182430.7493@uokmax.uucp> <9627@tekigm2.MEN.TEK.COM> <1990Jul31.023745.1116@water.waterloo.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!yale!mintaka!bloom-beacon!eru!luth!sunic!mcsun!unido!sbsvax!fs-info From: fs-info@sbsvax.cs.uni-sb.de (c/o Peter Gaal) Newsgroups: comp.os.msdos.programmer Subject: Re: Need help:Ctrl-C and Ctrl-Break Summary: Not so complicated... Message-ID: <5717@sbsvax.cs.uni-sb.de> Date: 31 Jul 90 10:57:18 GMT References: <1990Jul30.182430.7493@uokmax.uucp> <9627@tekigm2.MEN.TEK.COM> <1990Jul31.023745.1116@water.waterloo.edu> Organization: Universitaet des Saarlandes, Saarbruecken, W-Germany Lines: 43