home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / insidetp / 1990_05 / testbrk.pas < prev    next >
Pascal/Delphi Source File  |  1990-04-16  |  896b  |  42 lines

  1. PROGRAM TestBrk;
  2. {Test program for BREAK.PAS UNIT}
  3. USES
  4.   Break, CRT;
  5. VAR
  6.   Count, Attempts : Word;
  7. BEGIN
  8.   ClrScr;
  9.   TrapCtrlBrkOn;  {Start Ctrl-Break trapping}
  10.   GotoXY(26,12);
  11.   Write('# of Ctrl-Break attempts = ');
  12.   GotoXY(33,13);
  13.   Write('Count = ');
  14.   {Allow 5 Ctrl-Break attempts before continuing}
  15.   WHILE Attempts < 5 DO
  16.     BEGIN
  17.       IF BrkTrapped THEN
  18.         BEGIN
  19.           Inc(Attempts);
  20.           GotoXY(53,12);
  21.           WriteLn(Attempts:2);
  22.           BrkTrapped := FALSE
  23.         END;
  24.       Inc(Count);
  25.       GotoXY(40,13);
  26.       WriteLn(Count:6)
  27.     END;
  28.   TrapCtrlBrkOff;  {Normal Ctrl-Break processing}
  29.   GotoXY(26,16);
  30.   WriteLn('Now you may break out of me!');
  31.   Count := 0;
  32.   GotoXY(33,18);
  33.   Write('Count = ');
  34.   WHILE TRUE DO
  35.     BEGIN {Infinite loop}
  36.       Inc(Count);
  37.       GotoXY(40,18);
  38.       WriteLn(Count:6)
  39.     END
  40. END.
  41.  
  42.