home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / KBKCFLSH.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  1.6 KB  |  61 lines

  1. /**
  2. *
  3. * Name        KBKCFLSH -- Call the key control procedure to flush
  4. *                the keyboard buffer.
  5. *
  6. * Synopsis    kbkcflsh(pfunction, pfunction_data);
  7. *
  8. *        PKEY_CONTROL pfunction      The address of the function
  9. *                      that is called to flush the
  10. *                      keyboard buffer.  It must
  11. *                      have a single parameter of
  12. *                      type KB_DATA *. This function
  13. *                      is called the key control
  14. *                      function.
  15. *        void *pfunction_data      The address of an information
  16. *                      record to be passed to the key
  17. *                      control function.
  18. *
  19. * Description    KBKCFLSH calls the key control procedure to flush
  20. *        the keyboard buffer.  This is accomplished by setting
  21. *        the control_action field of the KB_DATA structure to
  22. *        KB_FLUSH.  See KBPOLL for more information on the key
  23. *        control function.
  24. *
  25. *        If the key control function is NIL, KBKCFLSH calls
  26. *        KBFLUSH to flush the keyboard buffer.
  27. *
  28. * Returns    nothing.
  29. *
  30. * Version    6.00 (C)Copyright Blaise Computing Inc.  1989
  31. *
  32. **/
  33. #include <bkeybrd.h>
  34.  
  35. void kbkcflsh(pfunction, pfunction_data)
  36. PKEY_CONTROL pfunction;
  37. void *pfunction_data;
  38. {
  39.     KB_DATA key_control_data;
  40.  
  41.     if (pfunction == 0)
  42.     {
  43.     kbflush();
  44.     return;
  45.     }
  46.  
  47.     key_control_data.key_seq.character_code = 0;
  48.     key_control_data.key_seq.key_code        = 0;
  49.     key_control_data.pfunction_data        = pfunction_data;
  50.     key_control_data.control_action        = KB_FLUSH;
  51.     key_control_data.key_found            = KB_NO_KEY_FOUND;
  52.     key_control_data.returned_action        = KB_FLUSH;
  53.  
  54.     pfunction(&key_control_data);
  55.  
  56.     if (key_control_data.returned_action == KB_FLUSH)
  57.     kbflush();
  58.  
  59.     return;
  60. }
  61.