home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / alt / msdos / programm / 2251 < prev    next >
Encoding:
Internet Message Format  |  1992-08-25  |  3.8 KB

  1. Path: sparky!uunet!olivea!news.bbn.com!usc!sdd.hp.com!elroy.jpl.nasa.gov!news.larc.nasa.gov!lll-winken!taco!dspascha
  2. From: dspascha@eos.ncsu.edu (DAVID SCOTT PASCHAL)
  3. Newsgroups: alt.msdos.programmer
  4. Subject: Windows and PrintScreen
  5. Message-ID: <1992Aug25.150006.19823@ncsu.edu>
  6. Date: 25 Aug 92 15:00:06 GMT
  7. Sender: news@ncsu.edu (USENET News System)
  8. Reply-To: dspascha@eos.ncsu.edu (DAVID SCOTT PASCHAL)
  9. Organization: North Carolina State University, Project Eos
  10. Lines: 58
  11. Originator: dspascha@c00044-100lez.eos.ncsu.edu
  12.  
  13.  
  14. Hi.  There's a lot going on about intercepting the keyboard interrupt(s) and
  15. whether or not this would work within Windows.  So I guess I'll put in my two
  16. cents worth:
  17.  
  18. The Windows keyboard driver completely takes over INT 9 (the keyboard interrupt)
  19. when Windows starts up.  However, in a DOS box, keystrokes WILL get passed to
  20. that DOS box's keyboard handler (but only in a foreground DOS box, not when a
  21. Windows application is in the foreground).  When a key is pressed when a DOS box
  22. is in the foreground, the following handlers are called by the Windows keyboard
  23. driver (with some help from the keyboard VDD in 386-enhanced mode):
  24. 1. Any handlers loaded by TSR's loaded into the DOS box (but only in the DOS
  25. box(es) it was loaded into).
  26. 2. Any handlers loaded before Windows was started (these will be active in ALL
  27. DOS boxes).
  28. 3. The default ROM-BIOS handler.
  29. In Enhanced mode Windows always comes in first and passes the keystroke to the
  30. DOS box.  In Real and Standard mode I'm not sure if Windows comes in first or
  31. after (1) above.  (Based on the fact that the system is running in real mode and
  32. not V86 protected mode in Real and Standard modes, I would guess that Windows
  33. would come in after (1).  However, if Windows reprograms the IRQ0-7 addresses,
  34. then maybe it would get the keytroke first.)
  35.  
  36. Denis Beauregard wrote something to the effect that once you've hooked INT 9 you
  37. have to handle every keystroke that comes along (having the effect of being
  38. "stuck" with English-language drivers or what not).  This is not quite so.
  39. Unless this is specifically what you want to do, you should only consume the
  40. keystrokes you want (i.e. if it's "your" hotkey) -- otherwise, you should pass
  41. the keystroke to the previous INT 9 handler.
  42.  
  43. I have written a little TSR that allows me to enter German characters from my
  44. American keyboard, and I have never had any problems using this feature (which
  45. is loaded in AUTOEXEC.BAT) in DOS boxes.
  46.  
  47. There is another wrinkle to this: On PS/2 BIOSes and many recent clone BIOSes,
  48. you can hook INT 15h function 4Fh instead of INT 9 -- The ROM-BIOS calls this
  49. from its INT 9 handler after it's gotten a scan code from the keyboard, and
  50. your 15/4F handler can either ignore the keystroke (passed in AL) and chain
  51. to the previous INT 15 handler, modify the keystroke (pass a new one in AL) and
  52. chain to the previous INT 15 handler, or consume the keystroke and do an IRET
  53. instead of chaining to the previous INT 15 handler.  Whether or not to keep or
  54. discard the keystroke depends on the state of the carry flag when the ROM-BIOS
  55. regains control after the INT 15h instruction (But since I don't have any docs
  56. on me right now, I can't tell you which setting of the carry flag means whether
  57. to discard the keystroke or keep the keystroke and try to turn it into a
  58. character.)
  59.  
  60. So anyway, regarding writing a PutBackPrintScreen program, I would say try to
  61. write an INT 9 handler that captures PrintScreen and invokes the ROM-BIOS's
  62. INT 5 handler.  See if the PIF settings will let you "reserve PrintScreen for
  63. the DOS application".  On the other hand, you could define another keystroke
  64. (like alt-scrolllock or something) that invokes PrintScreen.  That might be
  65. your better bet.
  66.  
  67. I hope this helps.
  68.  
  69. Tschuess, (Sorry, Compose-Character doesn't seem to work on these DECstations!)
  70. David :-)
  71.