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

  1. /**
  2. *
  3. * Name        KBWAIT -- Return a key sequence using polling.
  4. *
  5. * Synopsis    key_pressed = kbwait(pfunction, pfunction_data);
  6. *
  7. *        KEY_SEQUENCE key_pressed  The returned character and
  8. *                      key code of the key sequence
  9. *                      pressed.
  10. *        PKEY_CONTROL pfunction      The address of the function
  11. *                      that is called between each
  12. *                      poll of the keyboard.  It must
  13. *                      have a single parameter of
  14. *                      type KB_DATA *. This function
  15. *                      is called the key control
  16. *                      function.
  17. *        void *pfunction_data      The address of an information
  18. *                      record to be passed to the key
  19. *                      control function.
  20. *
  21. * Description    KBWAIT returns the next key sequence entered at the
  22. *        keyboard using polling (KBPOLL). When a key sequence
  23. *        is available, the key code and character code are
  24. *        read and returned as a KEY_SEQUENCE structure.
  25. *
  26. *        Since KBWAIT uses KBPOLL, the specified key control
  27. *        function whose address is specified is called between
  28. *        each poll of the keyboard.  See KBPOLL for more
  29. *        information on the key control function.
  30. *
  31. * Returns    KEY_SEQUENCE key_sequence  Character code & key code of
  32. *                       key pressed, or substitute
  33. *                       values supplied by the key
  34. *                       control function.
  35. *
  36. * Version    6.00 (C)Copyright Blaise Computing Inc.  1989
  37. *
  38. **/
  39. #include <bkeybrd.h>
  40.  
  41. KEY_SEQUENCE kbwait(pfunction, pfunction_data)
  42. PKEY_CONTROL pfunction;
  43. void *pfunction_data;
  44. {
  45.     KEY_SEQUENCE return_value;
  46.  
  47.     /* Loop until KBPOLL reports a keystroke has been found.          */
  48.     while (kbpoll(pfunction, pfunction_data, &return_value,
  49.           KB_REMOVE_KEY) != KB_KEY_FOUND)
  50.     ;
  51.  
  52.     return(return_value);
  53. }
  54.