Path: utzoo!attcan!uunet!cs.utexas.edu!yale!cs.yale.edu!spolsky-joel From: spolsky-joel@cs.yale.edu (Joel Spolsky) Newsgroups: comp.os.msdos.programmer Subject: Re: Over-riding ^C termination via TPascal 4.0 Message-ID: <26028@cs.yale.edu> Date: 6 Sep 90 13:57:08 GMT References: Sender: news@cs.yale.edu Distribution: comp Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158 Lines: 23 Nntp-Posting-Host: zoo-gw.cs.yale.edu Originator: spolsky@suned.CS.Yale.Edu In article billq@ms.uky.edu (Billy Quinn) writes: >Is there any way I can compile a program written in pascal (Turbo PASCAL) >version 4.0, so that the program won't terminate with the ^C or ^[break] >keys? One way to do this: - use the bios directly to get all keystrokes; there is a function in TurboPascal (probably called BiosKey or something) to do this. That will let you get ^C, ^S, ^P, ^Q, and lots of other goodies that would otherwise have special meaning. - install your own ctrl-break handler. For this I refer you to any good book on programming with interrupts, or the interrupt list. Basically you need to use the DOS getvector function to find out where ctrl-break's are going, then DOS setvector to redirect them to one of your functions, then finally setvector when your program exits to restore the original Ctrl-Break handler. Perhaps there is some built in Turbo Pascal-specific way to do this? Joel Spolsky spolsky@cs.yale.edu Talk Hard.