home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / SNIPKBIO.H < prev    next >
C/C++ Source or Header  |  1997-07-05  |  3KB  |  87 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **    SNIPKBIO.H - Snippets header file for keyboard I/O function
  5. */
  6.  
  7. #ifndef SNIPKBIO__H
  8. #define SNIPKBIO__H
  9.  
  10. #include <dos.h>
  11. #include <conio.h>
  12. #include "sniptype.h"
  13. #include "pchwio.h"
  14.  
  15. Boolean_T getYN(char *prompt, int def_ch,             /* Getyn.C        */
  16.                 unsigned timeout);
  17.  
  18. int  ungetkey(unsigned short key);                    /* Kb_Stuff.C     */
  19. int  KB_stuff(char *str);                             /* Kb_Stuff.C     */
  20.  
  21. int  IsLeftShift(void);                               /* Isshift.C      */
  22. int  IsRightShift(void);                              /* Isshift.C      */
  23. int  IsShift(void);                                   /* Isshift.C      */
  24.  
  25. int  IsLeftAlt(void);                                 /* Isshift.C      */
  26. int  IsRightAlt(void);                                /* Isshift.C      */
  27. int  IsAlt(void);                                     /* Isshift.C      */
  28.  
  29. int  IsLeftCtl(void);                                 /* Isshift.C      */
  30. int  IsRightCtl(void);                                /* Isshift.C      */
  31. int  IsCtl(void);                                     /* Isshift.C      */
  32.  
  33. int  IsSysRq(void);                                   /* Isshift.C      */
  34. int  timed_getch(int n_seconds);                      /* Timegetc.C     */
  35. int  isxkeybrd(void);                                 /* Isxkbrd.C      */
  36. void setcaps(void);                                   /* Keylocks.C     */
  37. void clrcaps(void);                                   /* Keylocks.C     */
  38. void setnumlock(void);                                /* Keylocks.C     */
  39. void clrnumlock(void);                                /* Keylocks.C     */
  40.  
  41. #define     RIGHT_SHIFT       0x0001
  42. #define     LEFT_SHIFT        0x0002
  43.  
  44. #define     EITHER_ALT        0x0008
  45. #define     LEFT_ALT          0x0200
  46.  
  47. #define     EITHER_CTL        0x0004
  48. #define     LEFT_CTL          0x0100
  49.  
  50. #if defined(__OS2__)
  51.  #define    SYSRQ             0x8000
  52. #else /* assume DOS */
  53.  #define    SYSRQ             0x0400
  54. #endif
  55.  
  56. #ifdef __OS2__
  57.  #define INCL_NOPM
  58.  #define INCL_KBD
  59.  #define INCL_DOSPROCESS    /* for DosSleep() */
  60.  #include <os2.h>
  61.  
  62. KBDINFO setkbmode(void);    /* Change keyboard to binary mode */
  63. void restkbmode(KBDINFO);   /* restore keyboard mode */
  64.                             /* both defined in EXT_KEYS.C */
  65.  
  66. /* 30-Mar-96 - EBB:
  67. ** OS/2 doesn't have a place in memory where information about the last
  68. ** key is held, like DOS does.      All the information about a keystroke is
  69. ** wrapped up into a structure (KBDKEYINFO) returned from OS/2's
  70. ** get-a-key API call, KbdCharIn(), so if you want to query that information
  71. ** at some arbitrary later time, you have to save it somewhere.  I have
  72. ** chosen to use a global variable defined in ISSHIFT.C to do this.  The
  73. ** functions in ISSHIFT.C report the status of the last key stored in that
  74. ** global, which may not be the last key pressed in your program if you're
  75. ** also storing keystrokes elsewhere.
  76. */
  77. extern KBDKEYINFO ki;         /* Holds key info - defined in ISSHIFT.C */
  78.  
  79.  #define peekkey()      (&ki.fsState)
  80. #else /* !__OS2__ */
  81.  #define key_seg  0x40
  82.  #define key_off  0x17
  83.  #define peekkey()      ((unsigned short FAR*) MK_FP(key_seg, key_off))
  84. #endif
  85.  
  86. #endif /* SNIPKBIO__H */
  87.