Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.os.msdos.programmer FAQ part 2/5
Section - - How can I disable the print screen function?

( Part1 - Part2 - Part3 - Part4 - Part5 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Counties ]


Top Document: comp.os.msdos.programmer FAQ part 2/5
Previous Document: - How can I disable Ctrl-C/Ctrl-Break and/or Ctrl-Alt-Del?
Next Document: - How can my program turn NumLock (CapsLock, ScrollLock) on or off?
See reader questions & answers on this topic! - Help others by sharing your knowledge

 There are really two print screen functions: 1) print current screen
 snapshot, triggered by PrintScreen or Shift- PrtSc or Shift-gray*, and
 2) turn on continuous screen echo, started and stopped by Ctrl-P or
 Ctrl-PrtSc.

 1) Screen snapshot to printer:

 The BIOS uses INT 5 for this. Fortunately, you don't need to mess with
 that interrupt handler. The standard handler, in BIOS versions dated
 December 1982 or later, uses a byte at 0040:0100 (= 0000:0500) to
 determine whether a print screen is currently in progress. If it is,
 pressing PrintScreen again is ignored. So to disable the screen
 snapshot, all you have to do is write a 1 to that byte. When the user
 presses PrintScreen, the BIOS will think that a print screen is already
 in progress and will ignore the user's keypress. You can re-enable
 PrintScreen by zeroing the same byte.

 Here's some simple code:

   void prtsc_allow(int allow) /* 0=disable, nonzero=enable */
   {
     unsigned char far* flag = (unsigned char far*)0x00400100UL;
     *flag = (unsigned char)!allow;
   }

 2) Continuous echo of screen to printer:

 If ANSI.SYS is loaded, you can easily disable the continuous echo of
 screen to printer (Ctrl-P or Ctrl- PrtSc). Just redefine the keys by
 "printing" strings like these to the screen (BASIC print, C printf(),
 Pascal Write statements, or ECHO command in batch files), where <27>
 stands for the Escape character, ASCII 27:

   <27>[0;114;"Ctrl-PrtSc disabled"p
   <27>[16;"^P"p

 If you haven't installed ANSI.SYS, I can't offer an easy way to disable
 the echo-screen-to-printer function.

 Actually, you might not need to disable Ctrl-P and Ctrl- PrtSc. If your
 only concern is not locking up your machine, when you see the "Abort,
 Retry, Ignore, Fail" prompt just press Ctrl-P again and then press I. As
 an alternative, install one of the many print spoolers that intercept
 printer-status queries and always return "Printer ready".

User Contributions:

1
Ben in Seattle
Jun 2, 2026 @ 4:16 pm
Another solution is to use a parallel port loopback plug. It makes the PC think there is a printer attached. The benefit of this is it doesn't require anticipating the problem with ANSI.SYS escape sequences nor does it make you wait half an hour for the "Abort, Retry, Ignore?" prompt, as some versions of DOS do.

Comment about this article, ask questions, or add new information about this topic:




Top Document: comp.os.msdos.programmer FAQ part 2/5
Previous Document: - How can I disable Ctrl-C/Ctrl-Break and/or Ctrl-Alt-Del?
Next Document: - How can my program turn NumLock (CapsLock, ScrollLock) on or off?

Part1 - Part2 - Part3 - Part4 - Part5 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
jeffrey@carlyle.org (Jeffrey Carlyle)





Last Update March 27 2014 @ 02:11 PM