home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 8076 < prev    next >
Encoding:
Internet Message Format  |  1993-01-12  |  1.3 KB

  1. Xref: sparky comp.lang.pascal:8076 comp.os.msdos.misc:6982 comp.sys.ibm.pc.misc:16570
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!ohstpy!miavx1!apsvax.aps.muohio.edu!sjmadsen
  3. Newsgroups: comp.lang.pascal,comp.os.msdos.misc,comp.sys.ibm.pc.misc
  4. Subject: Re: Switch video mode in Turbo Pascal (5.5, 8514)
  5. Message-ID: <1993Jan12.092556.14979@miavx1.acs.muohio.edu>
  6. From: sjmadsen@apsvax.aps.muohio.edu (Steve Madsen)
  7. Date: 12 Jan 93 00:53:46 -0500
  8. References: <1993Jan11.090744.4311@fwi.uva.nl>
  9. Nntp-Posting-Host: apsvax.aps.muohio.edu
  10. X-Newsreader: TIN [version 1.1 PL6]
  11. Lines: 28
  12.  
  13.     Sure, this is easy.  All you need to do is hook a procedure to
  14. the global variable ExitProc, which contains a far pointer to a
  15. procedure, and is *always* called by Turbo when program termination
  16. comes about, for any reason like runtime errors or Halts, or whatever.
  17.  
  18.     Basically, it's this simple:
  19.  
  20. Var
  21.   OldExit : Pointer;
  22.  
  23. {$F+}
  24. PROCEDURE MyExit;
  25.  begin
  26.    ExitProc := OldExit;  { set hook back to old procedure }
  27.    ...
  28.  end;
  29. {$F-}
  30.  
  31. ..
  32.  
  33. BEGIN
  34.   OldExit := ExitProc;
  35.   ExitProc := @MyExit;
  36. END.
  37.  
  38.     Then you just need to put something like TextMode(LastMode) or
  39. TextMode(CO80) into your exit procedure, and the text screen should
  40. always come back normally.
  41.