TMCLELLA@UALTAVM.BITNET (Tim Mclellan) (08/08/89)
Does anyone have PASCAL code that will disable CTRL-BREAK from stopping a compiled program? (I am using Turbo P). Thanks in advance. Tim McLellan
ts@chyde.uwasa.fi (Timo Salmi LASK) (08/11/89)
In article <630@UALTAVM.BITNET> TMCLELLA@UALTAVM.BITNET writes: >Does anyone have PASCAL code that will disable CTRL-BREAK >from stopping a compiled program? (I am using Turbo P). uses Crt; . CheckBreak := false; (It is in the manual, but never mind.) ................................................................... Prof. Timo Salmi (Site 128.214.12.3) School of Business Studies, University of Vaasa, SF-65101, Finland Internet: ts@chyde.uwasa.fi Funet: vakk::salmi Bitnet: salmi@finfun
aca1@CUNIXA.CC.COLUMBIA.EDU (Andrew C Athan) (08/11/89)
In article <630@UALTAVM.BITNET> you write: >Does anyone have PASCAL code that will disable CTRL-BREAK >from stopping a compiled program? (I am using Turbo P). If you're using Turbo Pascal 4.0 or above you can do the following: CheckBreak:=false; PQ?
azarian@hpcc01.HP.COM (Randy Azarian) (08/15/89)
Here is the code in assembly, and a demonstration in Microsoft C. If anyone wants to convert the assembly interface to Microsoft Pascal, *I'd* be interested. ; Ctrl-C/Ctrl-Break handler DGROUP GROUP _DATA _TEXT SEGMENT byte public 'CODE' ASSUME cs:_TEXT,ds:DGROUP ; ; the interrupt 23H handler INT23Handler PROC far push ds ; preserve all registers used push ax ; in this interrupt handler mov ax,seg DGROUP ; set DS to the segment where mov ds,ax ; the flag is located inc word ptr _INT23flag ; increment the flag pop ax ; restore regs and return pop ds iret INT23Handler ENDP ; ; the C-callable installation routine: PUBLIC _Install _Install PROC near push bp ; the usual C prologue mov bp,sp push ds ; preserve DS push cs ; set DS:DX to point to ... pop ds ; mov dx,offset INT23Handler ; ... the interrupt handler mov ax,2523h ; AH = DOS function number ; AL = interrupt number ; call DOS to update the int 21h ; interrupt vector pop ds pop bp ; restore regs and return ret _Install ENDP _TEXT ENDS ; ; the flag set by the interrupt 23H handler when Ctrl-C is pressed: _DATA SEGMENT word public 'DATA' PUBLIC _INT23flag _INT23flag dw 0 ; flag (initial value = 0) _DATA ENDS END /***************************************************************************/ /* C program to demonstrate Ctrl-C/Ctrl-Break handler, int23 */ /* Loop until ENTER is pressed. When Ctrl-Break is pressed, */ /* a message to that effect is displayed. */ /***************************************************************************/ extern int INT23flag; /* flag set when Ctrl-C is pressed */ main() { int keycode; Install(); /* install the interrupt 23H handler */ do { while (INT23flag > 0) { printf("\nCtrl-C was pressed"); /* show a message */ --INT23flag; /* and decrement the flag */ } if ( kbhit() ) /* look for a keypress */ keycode = getch(); else keycode = 0; } while (keycode != 0x0D); /* loop until Enter is pressed */ }