home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20052 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  2.0 KB

  1. Path: sparky!uunet!noc.near.net!bigboote.WPI.EDU!nntp!tomster
  2. From: tomster@bigwpi.WPI.EDU (Thomas Richard Dibble)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Telling if the SHIFT key is down.
  5. Date: 21 Jan 93 22:36:54
  6. Organization: ZikZak Corporation
  7. Lines: 39
  8. Message-ID: <TOMSTER.93Jan21223654@bigwpi.WPI.EDU>
  9. References: <00966E8E.9CED30C0@Msu.oscs.montana.edu>
  10. NNTP-Posting-Host: bigwpi.wpi.edu
  11. In-reply-to: ooprb@Msu.oscs.montana.edu's message of Thu, 21 Jan 1993 04:02:10 GMT
  12.  
  13. >>>>> On Thu, 21 Jan 1993 04:02:10 GMT, ooprb@Msu.oscs.montana.edu said:
  14.  
  15.   o> Thank you in advance for any help.
  16.  
  17.   o> REQUEST: With Dos 5.0 and Borland 3.0, I would like to tell if
  18.   o> the shift key (ignoring all other keys presses) is being held
  19.   o> down on the go - not waiting for any key press.
  20.  
  21.   o> TRIED: I've tried kbhit() and bioskey(0/1) with no success.
  22.  
  23.   o> WHAT FOR: I'm writting a program that updates numbers by the
  24.   o> press of a mouse button.  I would like to change the value by a
  25.   o> different amount if the shift key is being pressed when a mouse
  26.   o> button is pressed.
  27.  
  28. simple --
  29. "
  30.     unsigned char far *key_flags = MK_FP(0, 0x417);
  31. "
  32.  
  33. when key_flags == 0x2a the left shift is depressed, 0x36 means right
  34. shift.  also, an inportb(0x60) will give you the same info, but the
  35. returned byte will have bit 1 (the least significant bit) set for one
  36. key and bit 2 set for the other (I forget which is which).
  37.  
  38. I would consider the other poster's advice and abandone the idea of
  39. keyboard-modifying the mouse unless it is absolutely necessary (ie,
  40. you already are using both buttons).
  41.  
  42.   o> Rocky B.  - ooprb@trex.oscs.montana.edu
  43.  
  44.         ---- tomster@wpi.wpi.edu
  45.  
  46. --
  47. /****************************************************************************\
  48. | "I sometimes used to try to catch her, :    FROM:   tomster@wpi.wpi.edu  |
  49. | but never even caught her name."     :    TO:    who(m)ever reads it  |
  50. |    ---- the cure             :    CC:    programming language |
  51. \vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv/
  52.