home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / GENINC32.PAK / WINCON.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  13.8 KB  |  689 lines

  1. /*++ BUILD Version: 0002    // Increment this if a change has global effects
  2.  
  3. Module Name: wincon.x
  4.  
  5. Abstract:
  6.  
  7.     This module contains the public data structures, data types,
  8.     and procedures exported by the NT console subsystem.
  9.  
  10. --*/
  11.  
  12. /*
  13.  *      C/C++ Run Time Library - Version 6.0
  14.  *
  15.  *      Copyright (c) 1990, 1993 by Borland International
  16.  *      All Rights Reserved.
  17.  *
  18.  */
  19.  
  20. #ifndef _WINCON_
  21. #define _WINCON_
  22.  
  23. #ifndef __WINDEF_H
  24. #include <windef.h>
  25. #endif
  26.  
  27. #ifndef __WINBASE_H
  28. #include <winbase.h>
  29. #endif
  30.  
  31. #ifndef RC_INVOKED
  32. #pragma pack(4)
  33. #endif  /* RC_INVOKED */
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. typedef struct _COORD {
  40.     SHORT X;
  41.     SHORT Y;
  42. } COORD, *PCOORD;
  43.  
  44. typedef struct _SMALL_RECT {
  45.     SHORT Left;
  46.     SHORT Top;
  47.     SHORT Right;
  48.     SHORT Bottom;
  49. } SMALL_RECT, *PSMALL_RECT;
  50.  
  51. typedef struct _KEY_EVENT_RECORD {
  52.     BOOL bKeyDown;
  53.     WORD wRepeatCount;
  54.     WORD wVirtualKeyCode;
  55.     WORD wVirtualScanCode;
  56.     union {
  57.         WCHAR UnicodeChar;
  58.         CHAR   AsciiChar;
  59.     } uChar;
  60.     DWORD dwControlKeyState;
  61. } KEY_EVENT_RECORD, *PKEY_EVENT_RECORD;
  62.  
  63. //
  64. // ControlKeyState flags
  65. //
  66.  
  67. #define RIGHT_ALT_PRESSED     0x0001 // the right alt key is pressed.
  68. #define LEFT_ALT_PRESSED      0x0002 // the left alt key is pressed.
  69. #define RIGHT_CTRL_PRESSED    0x0004 // the right ctrl key is pressed.
  70. #define LEFT_CTRL_PRESSED     0x0008 // the left ctrl key is pressed.
  71. #define SHIFT_PRESSED         0x0010 // the shift key is pressed.
  72. #define NUMLOCK_ON            0x0020 // the numlock light is on.
  73. #define SCROLLLOCK_ON         0x0040 // the scrolllock light is on.
  74. #define CAPSLOCK_ON           0x0080 // the capslock light is on.
  75. #define ENHANCED_KEY          0x0100 // the key is enhanced.
  76.  
  77. typedef struct _MOUSE_EVENT_RECORD {
  78.     COORD dwMousePosition;
  79.     DWORD dwButtonState;
  80.     DWORD dwControlKeyState;
  81.     DWORD dwEventFlags;
  82. } MOUSE_EVENT_RECORD, *PMOUSE_EVENT_RECORD;
  83.  
  84. //
  85. // ButtonState flags
  86. //
  87.  
  88. #define FROM_LEFT_1ST_BUTTON_PRESSED    0x0001
  89. #define RIGHTMOST_BUTTON_PRESSED        0x0002
  90. #define FROM_LEFT_2ND_BUTTON_PRESSED    0x0004
  91. #define FROM_LEFT_3RD_BUTTON_PRESSED    0x0008
  92. #define FROM_LEFT_4TH_BUTTON_PRESSED    0x0010
  93.  
  94. //
  95. // EventFlags
  96. //
  97.  
  98. #define MOUSE_MOVED   0x0001
  99. #define DOUBLE_CLICK  0x0002
  100.  
  101. typedef struct _WINDOW_BUFFER_SIZE_RECORD {
  102.     COORD dwSize;
  103. } WINDOW_BUFFER_SIZE_RECORD, *PWINDOW_BUFFER_SIZE_RECORD;
  104.  
  105. typedef struct _MENU_EVENT_RECORD {
  106.     UINT dwCommandId;
  107. } MENU_EVENT_RECORD, *PMENU_EVENT_RECORD;
  108.  
  109. typedef struct _FOCUS_EVENT_RECORD {
  110.     BOOL bSetFocus;
  111. } FOCUS_EVENT_RECORD, *PFOCUS_EVENT_RECORD;
  112.  
  113. typedef struct _INPUT_RECORD {
  114.     WORD EventType;
  115.     union {
  116.         KEY_EVENT_RECORD KeyEvent;
  117.         MOUSE_EVENT_RECORD MouseEvent;
  118.         WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
  119.         MENU_EVENT_RECORD MenuEvent;
  120.         FOCUS_EVENT_RECORD FocusEvent;
  121.     } Event;
  122. } INPUT_RECORD, *PINPUT_RECORD;
  123.  
  124. //
  125. //  EventType flags:
  126. //
  127.  
  128. #define KEY_EVENT         0x0001 // Event contains key event record
  129. #define MOUSE_EVENT       0x0002 // Event contains mouse event record
  130. #define WINDOW_BUFFER_SIZE_EVENT 0x0004 // Event contains window change event record
  131. #define MENU_EVENT 0x0008 // Event contains menu event record
  132. #define FOCUS_EVENT 0x0010 // event contains focus change
  133.  
  134. typedef struct _CHAR_INFO {
  135.     union {
  136.         WCHAR UnicodeChar;
  137.         CHAR   AsciiChar;
  138.     } Char;
  139.     WORD Attributes;
  140. } CHAR_INFO, *PCHAR_INFO;
  141.  
  142. //
  143. // Attributes flags:
  144. //
  145.  
  146. #define FOREGROUND_BLUE      0x0001 // text color contains blue.
  147. #define FOREGROUND_GREEN     0x0002 // text color contains green.
  148. #define FOREGROUND_RED       0x0004 // text color contains red.
  149. #define FOREGROUND_INTENSITY 0x0008 // text color is intensified.
  150. #define BACKGROUND_BLUE      0x0010 // background color contains blue.
  151. #define BACKGROUND_GREEN     0x0020 // background color contains green.
  152. #define BACKGROUND_RED       0x0040 // background color contains red.
  153. #define BACKGROUND_INTENSITY 0x0080 // background color is intensified.
  154.  
  155.  
  156. typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
  157.     COORD dwSize;
  158.     COORD dwCursorPosition;
  159.     WORD  wAttributes;
  160.     SMALL_RECT srWindow;
  161.     COORD dwMaximumWindowSize;
  162. } CONSOLE_SCREEN_BUFFER_INFO, *PCONSOLE_SCREEN_BUFFER_INFO;
  163.  
  164. typedef struct _CONSOLE_CURSOR_INFO {
  165.     DWORD  dwSize;
  166.     BOOL   bVisible;
  167. } CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO;
  168.  
  169. //
  170. // typedef for ctrl-c handler routines
  171. //
  172.  
  173. typedef
  174. BOOL
  175. (WINAPI *PHANDLER_ROUTINE)(
  176.     DWORD CtrlType
  177.     );
  178.  
  179. #define CTRL_C_EVENT        0
  180. #define CTRL_BREAK_EVENT    1
  181. #define CTRL_CLOSE_EVENT    2
  182. // 3 is reserved!
  183. // 4 is reserved!
  184. #define CTRL_LOGOFF_EVENT   5
  185. #define CTRL_SHUTDOWN_EVENT 6
  186.  
  187. //
  188. //  Input Mode flags:
  189. //
  190.  
  191. #define ENABLE_PROCESSED_INPUT 0x0001
  192. #define ENABLE_LINE_INPUT      0x0002
  193. #define ENABLE_ECHO_INPUT      0x0004
  194. #define ENABLE_WINDOW_INPUT    0x0008
  195. #define ENABLE_MOUSE_INPUT     0x0010
  196.  
  197. //
  198. // Output Mode flags:
  199. //
  200.  
  201. #define ENABLE_PROCESSED_OUTPUT  0x0001
  202. #define ENABLE_WRAP_AT_EOL_OUTPUT  0x0002
  203.  
  204. //
  205. // direct API definitions.
  206. //
  207.  
  208. BOOL
  209. WINAPI
  210. PeekConsoleInputA(
  211.     HANDLE hConsoleInput,
  212.     PINPUT_RECORD lpBuffer,
  213.     DWORD nLength,
  214.     LPDWORD lpNumberOfEventsRead
  215.     );
  216. BOOL
  217. WINAPI
  218. PeekConsoleInputW(
  219.     HANDLE hConsoleInput,
  220.     PINPUT_RECORD lpBuffer,
  221.     DWORD nLength,
  222.     LPDWORD lpNumberOfEventsRead
  223.     );
  224. #ifdef UNICODE
  225. #define PeekConsoleInput PeekConsoleInputW
  226. #else
  227. #define PeekConsoleInput PeekConsoleInputA
  228. #endif // !UNICODE
  229.  
  230. BOOL
  231. WINAPI
  232. ReadConsoleInputA(
  233.     HANDLE hConsoleInput,
  234.     PINPUT_RECORD lpBuffer,
  235.     DWORD nLength,
  236.     LPDWORD lpNumberOfEventsRead
  237.     );
  238. BOOL
  239. WINAPI
  240. ReadConsoleInputW(
  241.     HANDLE hConsoleInput,
  242.     PINPUT_RECORD lpBuffer,
  243.     DWORD nLength,
  244.     LPDWORD lpNumberOfEventsRead
  245.     );
  246. #ifdef UNICODE
  247. #define ReadConsoleInput ReadConsoleInputW
  248. #else
  249. #define ReadConsoleInput ReadConsoleInputA
  250. #endif // !UNICODE
  251.  
  252. BOOL
  253. WINAPI
  254. WriteConsoleInputA(
  255.     HANDLE hConsoleInput,
  256.     PINPUT_RECORD lpBuffer,
  257.     DWORD nLength,
  258.     LPDWORD lpNumberOfEventsWritten
  259.     );
  260. BOOL
  261. WINAPI
  262. WriteConsoleInputW(
  263.     HANDLE hConsoleInput,
  264.     PINPUT_RECORD lpBuffer,
  265.     DWORD nLength,
  266.     LPDWORD lpNumberOfEventsWritten
  267.     );
  268. #ifdef UNICODE
  269. #define WriteConsoleInput WriteConsoleInputW
  270. #else
  271. #define WriteConsoleInput WriteConsoleInputA
  272. #endif // !UNICODE
  273.  
  274. BOOL
  275. WINAPI
  276. ReadConsoleOutputA(
  277.     HANDLE hConsoleOutput,
  278.     PCHAR_INFO lpBuffer,
  279.     COORD dwBufferSize,
  280.     COORD dwBufferCoord,
  281.     PSMALL_RECT lpReadRegion
  282.     );
  283. BOOL
  284. WINAPI
  285. ReadConsoleOutputW(
  286.     HANDLE hConsoleOutput,
  287.     PCHAR_INFO lpBuffer,
  288.     COORD dwBufferSize,
  289.     COORD dwBufferCoord,
  290.     PSMALL_RECT lpReadRegion
  291.     );
  292. #ifdef UNICODE
  293. #define ReadConsoleOutput ReadConsoleOutputW
  294. #else
  295. #define ReadConsoleOutput ReadConsoleOutputA
  296. #endif // !UNICODE
  297.  
  298. BOOL
  299. WINAPI
  300. WriteConsoleOutputA(
  301.     HANDLE hConsoleOutput,
  302.     PCHAR_INFO lpBuffer,
  303.     COORD dwBufferSize,
  304.     COORD dwBufferCoord,
  305.     PSMALL_RECT lpWriteRegion
  306.     );
  307. BOOL
  308. WINAPI
  309. WriteConsoleOutputW(
  310.     HANDLE hConsoleOutput,
  311.     PCHAR_INFO lpBuffer,
  312.     COORD dwBufferSize,
  313.     COORD dwBufferCoord,
  314.     PSMALL_RECT lpWriteRegion
  315.     );
  316. #ifdef UNICODE
  317. #define WriteConsoleOutput WriteConsoleOutputW
  318. #else
  319. #define WriteConsoleOutput WriteConsoleOutputA
  320. #endif // !UNICODE
  321.  
  322. BOOL
  323. WINAPI
  324. ReadConsoleOutputCharacterA(
  325.     HANDLE hConsoleOutput,
  326.     LPSTR lpCharacter,
  327.     DWORD nLength,
  328.     COORD dwReadCoord,
  329.     LPDWORD lpNumberOfCharsRead
  330.     );
  331. BOOL
  332. WINAPI
  333. ReadConsoleOutputCharacterW(
  334.     HANDLE hConsoleOutput,
  335.     LPWSTR lpCharacter,
  336.     DWORD nLength,
  337.     COORD dwReadCoord,
  338.     LPDWORD lpNumberOfCharsRead
  339.     );
  340. #ifdef UNICODE
  341. #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW
  342. #else
  343. #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA
  344. #endif // !UNICODE
  345.  
  346. BOOL
  347. WINAPI
  348. ReadConsoleOutputAttribute(
  349.     HANDLE hConsoleOutput,
  350.     LPWORD lpAttribute,
  351.     DWORD nLength,
  352.     COORD dwReadCoord,
  353.     LPDWORD lpNumberOfAttrsRead
  354.     );
  355.  
  356. BOOL
  357. WINAPI
  358. WriteConsoleOutputCharacterA(
  359.     HANDLE hConsoleOutput,
  360.     LPSTR lpCharacter,
  361.     DWORD nLength,
  362.     COORD dwWriteCoord,
  363.     LPDWORD lpNumberOfCharsWritten
  364.     );
  365. BOOL
  366. WINAPI
  367. WriteConsoleOutputCharacterW(
  368.     HANDLE hConsoleOutput,
  369.     LPWSTR lpCharacter,
  370.     DWORD nLength,
  371.     COORD dwWriteCoord,
  372.     LPDWORD lpNumberOfCharsWritten
  373.     );
  374. #ifdef UNICODE
  375. #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW
  376. #else
  377. #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA
  378. #endif // !UNICODE
  379.  
  380. BOOL
  381. WINAPI
  382. WriteConsoleOutputAttribute(
  383.     HANDLE hConsoleOutput,
  384.     LPWORD lpAttribute,
  385.     DWORD nLength,
  386.     COORD dwWriteCoord,
  387.     LPDWORD lpNumberOfAttrsWritten
  388.     );
  389.  
  390. BOOL
  391. WINAPI
  392. FillConsoleOutputCharacterA(
  393.     HANDLE hConsoleOutput,
  394.     CHAR  cCharacter,
  395.     DWORD  nLength,
  396.     COORD  dwWriteCoord,
  397.     LPDWORD lpNumberOfCharsWritten
  398.     );
  399. BOOL
  400. WINAPI
  401. FillConsoleOutputCharacterW(
  402.     HANDLE hConsoleOutput,
  403.     WCHAR  cCharacter,
  404.     DWORD  nLength,
  405.     COORD  dwWriteCoord,
  406.     LPDWORD lpNumberOfCharsWritten
  407.     );
  408. #ifdef UNICODE
  409. #define FillConsoleOutputCharacter FillConsoleOutputCharacterW
  410. #else
  411. #define FillConsoleOutputCharacter FillConsoleOutputCharacterA
  412. #endif // !UNICODE
  413.  
  414. BOOL
  415. WINAPI
  416. FillConsoleOutputAttribute(
  417.     HANDLE hConsoleOutput,
  418.     WORD   wAttribute,
  419.     DWORD  nLength,
  420.     COORD  dwWriteCoord,
  421.     LPDWORD lpNumberOfAttrsWritten
  422.     );
  423.  
  424. BOOL
  425. WINAPI
  426. GetConsoleMode(
  427.     HANDLE hConsoleHandle,
  428.     LPDWORD lpMode
  429.     );
  430.  
  431. BOOL
  432. WINAPI
  433. GetNumberOfConsoleInputEvents(
  434.     HANDLE hConsoleInput,
  435.     LPDWORD lpNumberOfEvents
  436.     );
  437.  
  438. BOOL
  439. WINAPI
  440. GetConsoleScreenBufferInfo(
  441.     HANDLE hConsoleOutput,
  442.     PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo
  443.     );
  444.  
  445. COORD
  446. WINAPI
  447. GetLargestConsoleWindowSize(
  448.     HANDLE hConsoleOutput
  449.     );
  450.  
  451. BOOL
  452. WINAPI
  453. GetConsoleCursorInfo(
  454.     HANDLE hConsoleOutput,
  455.     PCONSOLE_CURSOR_INFO lpConsoleCursorInfo
  456.     );
  457.  
  458. BOOL
  459. WINAPI
  460. GetNumberOfConsoleMouseButtons(
  461.     LPDWORD lpNumberOfMouseButtons
  462.     );
  463.  
  464. BOOL
  465. WINAPI
  466. SetConsoleMode(
  467.     HANDLE hConsoleHandle,
  468.     DWORD dwMode
  469.     );
  470.  
  471. BOOL
  472. WINAPI
  473. SetConsoleActiveScreenBuffer(
  474.     HANDLE hConsoleOutput
  475.     );
  476.  
  477. BOOL
  478. WINAPI
  479. FlushConsoleInputBuffer(
  480.     HANDLE hConsoleInput
  481.     );
  482.  
  483. BOOL
  484. WINAPI
  485. SetConsoleScreenBufferSize(
  486.     HANDLE hConsoleOutput,
  487.     COORD dwSize
  488.     );
  489.  
  490. BOOL
  491. WINAPI
  492. SetConsoleCursorPosition(
  493.     HANDLE hConsoleOutput,
  494.     COORD dwCursorPosition
  495.     );
  496.  
  497. BOOL
  498. WINAPI
  499. SetConsoleCursorInfo(
  500.     HANDLE hConsoleOutput,
  501.     PCONSOLE_CURSOR_INFO lpConsoleCursorInfo
  502.     );
  503.  
  504. BOOL
  505. WINAPI
  506. ScrollConsoleScreenBufferA(
  507.     HANDLE hConsoleOutput,
  508.     PSMALL_RECT lpScrollRectangle,
  509.     PSMALL_RECT lpClipRectangle,
  510.     COORD dwDestinationOrigin,
  511.     PCHAR_INFO lpFill
  512.     );
  513. BOOL
  514. WINAPI
  515. ScrollConsoleScreenBufferW(
  516.     HANDLE hConsoleOutput,
  517.     PSMALL_RECT lpScrollRectangle,
  518.     PSMALL_RECT lpClipRectangle,
  519.     COORD dwDestinationOrigin,
  520.     PCHAR_INFO lpFill
  521.     );
  522. #ifdef UNICODE
  523. #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW
  524. #else
  525. #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA
  526. #endif // !UNICODE
  527.  
  528. BOOL
  529. WINAPI
  530. SetConsoleWindowInfo(
  531.     HANDLE hConsoleOutput,
  532.     BOOL bAbsolute,
  533.     PSMALL_RECT lpConsoleWindow
  534.     );
  535.  
  536. BOOL
  537. WINAPI
  538. SetConsoleTextAttribute(
  539.     HANDLE hConsoleOutput,
  540.     WORD wAttributes
  541.     );
  542.  
  543. BOOL
  544. WINAPI
  545. SetConsoleCtrlHandler(
  546.     PHANDLER_ROUTINE HandlerRoutine,
  547.     BOOL Add
  548.     );
  549.  
  550. BOOL
  551. WINAPI
  552. GenerateConsoleCtrlEvent(
  553.     DWORD dwCtrlEvent,
  554.     DWORD dwProcessGroupId
  555.     );
  556.  
  557. BOOL
  558. WINAPI
  559. AllocConsole( VOID );
  560.  
  561. BOOL
  562. WINAPI
  563. FreeConsole( VOID );
  564.  
  565.  
  566. DWORD
  567. WINAPI
  568. GetConsoleTitleA(
  569.     LPSTR lpConsoleTitle,
  570.     DWORD nSize
  571.     );
  572. DWORD
  573. WINAPI
  574. GetConsoleTitleW(
  575.     LPWSTR lpConsoleTitle,
  576.     DWORD nSize
  577.     );
  578. #ifdef UNICODE
  579. #define GetConsoleTitle GetConsoleTitleW
  580. #else
  581. #define GetConsoleTitle GetConsoleTitleA
  582. #endif // !UNICODE
  583.  
  584. BOOL
  585. WINAPI
  586. SetConsoleTitleA(
  587.     LPSTR lpConsoleTitle
  588.     );
  589. BOOL
  590. WINAPI
  591. SetConsoleTitleW(
  592.     LPWSTR lpConsoleTitle
  593.     );
  594. #ifdef UNICODE
  595. #define SetConsoleTitle SetConsoleTitleW
  596. #else
  597. #define SetConsoleTitle SetConsoleTitleA
  598. #endif // !UNICODE
  599.  
  600. BOOL
  601. WINAPI
  602. ReadConsoleA(
  603.     HANDLE hConsoleInput,
  604.     LPVOID lpBuffer,
  605.     DWORD nNumberOfCharsToRead,
  606.     LPDWORD lpNumberOfCharsRead,
  607.     LPVOID lpReserved
  608.     );
  609. BOOL
  610. WINAPI
  611. ReadConsoleW(
  612.     HANDLE hConsoleInput,
  613.     LPVOID lpBuffer,
  614.     DWORD nNumberOfCharsToRead,
  615.     LPDWORD lpNumberOfCharsRead,
  616.     LPVOID lpReserved
  617.     );
  618. #ifdef UNICODE
  619. #define ReadConsole ReadConsoleW
  620. #else
  621. #define ReadConsole ReadConsoleA
  622. #endif // !UNICODE
  623.  
  624. BOOL
  625. WINAPI
  626. WriteConsoleA(
  627.     HANDLE hConsoleOutput,
  628.     CONST VOID *lpBuffer,
  629.     DWORD nNumberOfCharsToWrite,
  630.     LPDWORD lpNumberOfCharsWritten,
  631.     LPVOID lpReserved
  632.     );
  633. BOOL
  634. WINAPI
  635. WriteConsoleW(
  636.     HANDLE hConsoleOutput,
  637.     CONST VOID *lpBuffer,
  638.     DWORD nNumberOfCharsToWrite,
  639.     LPDWORD lpNumberOfCharsWritten,
  640.     LPVOID lpReserved
  641.     );
  642. #ifdef UNICODE
  643. #define WriteConsole WriteConsoleW
  644. #else
  645. #define WriteConsole WriteConsoleA
  646. #endif // !UNICODE
  647.  
  648. #define CONSOLE_TEXTMODE_BUFFER  1
  649.  
  650. HANDLE
  651. WINAPI
  652. CreateConsoleScreenBuffer(
  653.     DWORD dwDesiredAccess,
  654.     DWORD dwShareMode,
  655.     LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  656.     DWORD dwFlags,
  657.     PVOID lpScreenBufferData
  658.     );
  659.  
  660. UINT
  661. WINAPI
  662. GetConsoleCP( VOID );
  663.  
  664. BOOL
  665. WINAPI
  666. SetConsoleCP(
  667.     UINT wCodePageID
  668.     );
  669.  
  670. UINT
  671. WINAPI
  672. GetConsoleOutputCP( VOID );
  673.  
  674. BOOL
  675. WINAPI
  676. SetConsoleOutputCP(
  677.     UINT wCodePageID
  678.     );
  679.  
  680. #ifdef __cplusplus
  681. }
  682. #endif
  683.  
  684. #ifndef RC_INVOKED
  685. #pragma pack()
  686. #endif  /* RC_INVOKED */
  687.  
  688. #endif // _WINCON_
  689.