home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / UUCODE / UUPC / TEST / UPC12ES1.ZIP / LIB / setstdin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-26  |  3.0 KB  |  77 lines

  1. /*--------------------------------------------------------------------*/
  2. /*       s e t s t d i n . c                                          */
  3. /*                                                                    */
  4. /*       Set Standard input for Windows/NT programs                   */
  5. /*--------------------------------------------------------------------*/
  6.  
  7. /*--------------------------------------------------------------------*/
  8. /*       Changes Copyright (c) 1989-1993 by Kendra Electronic         */
  9. /*       Wonderworks.                                                 */
  10. /*                                                                    */
  11. /*       All rights reserved except those explicitly granted by       */
  12. /*       the UUPC/extended license agreement.                         */
  13. /*--------------------------------------------------------------------*/
  14.  
  15. /*--------------------------------------------------------------------*/
  16. /*       Copyright (c) David M. Watt 1993                             */
  17. /*--------------------------------------------------------------------*/
  18.  
  19. /*--------------------------------------------------------------------*/
  20. /*                          RCS Information                           */
  21. /*--------------------------------------------------------------------*/
  22.  
  23. /*
  24.  *    $Id: setstdin.c 1.3 1993/10/26 12:45:46 ahd Exp $
  25.  *
  26.  *    $Log: setstdin.c $
  27.  *     Revision 1.3  1993/10/26  12:45:46  ahd
  28.  *     Add include of own header file
  29.  *
  30.  *     Revision 1.2  1993/10/12  00:47:57  ahd
  31.  *     Normalize comments
  32.  *
  33.  * Revision 1.1  1993/04/10  21:22:29  dmwatt
  34.  * Initial revision
  35.  *
  36.  *     Revision 1.1  1993/04/09  06:22:00  dmwatt
  37.  *     Written
  38.  */
  39.  
  40. /*--------------------------------------------------------------------*/
  41. /*                        System include files                        */
  42. /*--------------------------------------------------------------------*/
  43.  
  44. #include <stdio.h>
  45. #include <windows.h>
  46.  
  47. /*--------------------------------------------------------------------*/
  48. /*                    UUPC/extended include files                     */
  49. /*--------------------------------------------------------------------*/
  50.  
  51. #include "lib.h"
  52. #include "setstdin.h"
  53.  
  54. /*--------------------------------------------------------------------*/
  55. /*    s e t s t d i n m o d e                                         */
  56. /*                                                                    */
  57. /*    Set standard input on NT console for single char I/O            */
  58. /*--------------------------------------------------------------------*/
  59.  
  60. void setstdinmode(void)
  61. {
  62.    HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
  63.    DWORD mode;
  64.    BOOL bSuccess;
  65.  
  66.    bSuccess = GetConsoleMode(hStdIn, &mode);
  67.  
  68. /* Disable mouse events so that later Peeks() only get characters */
  69.    mode &= ~ENABLE_WINDOW_INPUT;
  70.    mode &= ~ENABLE_MOUSE_INPUT;
  71.    mode &= ~ENABLE_LINE_INPUT;
  72.    mode |= ENABLE_PROCESSED_INPUT;
  73.  
  74.    SetConsoleMode(hStdIn, mode);
  75.  
  76. }  /* setstdinmode */
  77.