home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / ISC366.ZIP / KBD / KBD.H < prev   
C/C++ Source or Header  |  1993-09-01  |  3KB  |  81 lines

  1. ///////////////////////////////////////////////////////////////////////////
  2. //                                                                       //
  3. //            File: Kbd.h                                                //
  4. //            started on: 28/7/93                                        //
  5. //                                                                       //
  6. ///////////////////////////////////////////////////////////////////////////
  7. //                                                                       //
  8. //  KBD allows you to hook a hotkey. Just pass the constructor your      //
  9. //  hotkey specifications and the hotkey function will be called         //
  10. //  whenever that hotkey is pressed.                                     //
  11. //                                                                       //
  12. ///////////////////////////////////////////////////////////////////////////
  13. //                                                                       //
  14. //                    by Ofer Laor (AKA LeucroTTA)                       //
  15. //                                                                       //
  16. ///////////////////////////////////////////////////////////////////////////
  17.  
  18. #ifndef __KBD_H
  19. #define __KBD_H
  20.  
  21. #include "isc.h"; // ISC.
  22.  
  23. // keyboard hooking class.
  24. class KBD : public ISC {
  25.  
  26.       unsigned char bScanCode, bControls; // hotkey params.
  27.  
  28.       unsigned char far *pShift;          // bios shift state buffer.
  29.       virtual void isr(void);
  30.       int fKillKey;                       // should hotkey be ingnored by the forground app?
  31.  
  32. protected:
  33.           virtual void hotkey(void) {};   // hotkey func.
  34.           virtual int kill_key(void) { return fKillKey; };  // decides whether to kill key.
  35.  
  36. public:
  37.        KBD(unsigned char scan_code, unsigned char controls= 0, int kill_key= 1);
  38. };
  39.  
  40. // shift states.
  41. const unsigned char KBS_ALT= 0x8,  KBS_CONTROL= 0x4, KBS_LSHIFT= 0x2, KBS_RSHIFT= 0x1;
  42.  
  43. // both shifts down.
  44. const unsigned char KBS_SHIFT= KBS_LSHIFT| KBS_RSHIFT;
  45.  
  46. // normal KEYS states.
  47. enum KB_KEYS {KB_Esc= 0x1,
  48.               KB_1,KB_2,KB_3,KB_4,KB_5,KB_6,KB_7,KB_8,KB_9,KB_0,
  49.               KB_MINUS= 0xc,KB_PLUS,
  50.               KB_BKSP,
  51.               KB_TAB,
  52.               KB_Q,KB_W,KB_E,KB_R,KB_T,KB_Y,KB_U,KB_I,KB_O,KB_P,
  53.               KB_SQUARE_OPEN= 0x1a,KB_SQUARE_CLOSE,
  54.               KB_ENTER,
  55.               KB_CTRL,
  56.               KB_A,KB_S,KB_D,KB_F,KB_G,KB_H,KB_J,KB_K,KB_L= 0X26,
  57.               KB_SEMICOLON,KB_QUOTE,KB_APOSTROPHE,
  58.               KB_LSHIFT,
  59.               KB_BACKSLASH,
  60.               KB_Z,KB_X,KB_C,KB_V,KB_B,KB_N,KB_M,
  61.               KB_COMMA,KB_DOT,KB_SLASH,
  62.               KB_RSHIFT,
  63.               KB_PRTSCR,
  64.               KB_ALT,
  65.               KB_SPACE,
  66.               KB_CAPS= 0x3a,
  67.               KB_F1,KB_F2,KB_F3,KB_F4,KB_F5,KB_F6,KB_F7,KB_F8,KB_F9,KB_F10,
  68.               KB_NUMLOCK,KB_SCROLL,KB_HOME,
  69.               KB_UP,KB_PGUP,
  70.               KB_GRAY_MINUS,
  71.               KB_LEFT,
  72.               KB_GRAY_5,
  73.               KB_RIGHT,
  74.               KB_GRAY_PLUS,
  75.               KB_END,KB_DOWN,KB_PGDWN,
  76.               KB_INS,KB_DEL,
  77.               KB_F11= 0x85, KB_F12
  78. };
  79.  
  80.  
  81. #endif /* __KBD_H */