├── .gitattributes ├── .gitignore ├── .openpublishing.publish.config.json ├── LICENSE ├── LICENSE-CODE ├── README.md ├── ThirdPartyNotices ├── consoles-redirects.csv └── docs ├── TOC.md ├── about-character-mode-applications.md ├── addconsolealias.md ├── allocconsole.md ├── attachconsole.md ├── attaching-to-a-console.md ├── breadcrumb └── toc.yml ├── char-info-str.md ├── character-mode-applications.md ├── classic-vs-vt.md ├── clearing-the-screen.md ├── closepseudoconsole.md ├── closing-a-console.md ├── console-aliases.md ├── console-application-issues.md ├── console-buffer-security-and-access-rights.md ├── console-code-pages.md ├── console-control-handlers.md ├── console-cursor-info-str.md ├── console-font-info-str.md ├── console-font-infoex.md ├── console-functions.md ├── console-handles.md ├── console-history-info.md ├── console-input-buffer.md ├── console-modes.md ├── console-process-groups.md ├── console-readconsole-control.md ├── console-reference.md ├── console-screen-buffer-info-str.md ├── console-screen-buffer-infoex.md ├── console-screen-buffers.md ├── console-selection-info-str.md ├── console-selection.md ├── console-structures.md ├── console-virtual-terminal-sequences.md ├── console-winevents.md ├── consolecontrol.md ├── consoles.md ├── coord-str.md ├── createconsolescreenbuffer.md ├── createpseudoconsole.md ├── creating-a-pseudoconsole-session.md ├── creation-of-a-console.md ├── ctrl-c-and-ctrl-break-signals.md ├── ctrl-close-signal.md ├── definitions.md ├── docfx.json ├── ecosystem-roadmap.md ├── fillconsoleoutputattribute.md ├── fillconsoleoutputcharacter.md ├── flushconsoleinputbuffer.md ├── focus-event-record-str.md ├── freeconsole.md ├── generateconsolectrlevent.md ├── getconsolealias.md ├── getconsolealiases.md ├── getconsolealiaseslength.md ├── getconsolealiasexes.md ├── getconsolealiasexeslength.md ├── getconsolecp.md ├── getconsolecursorinfo.md ├── getconsoledisplaymode.md ├── getconsolefontsize.md ├── getconsolehistoryinfo.md ├── getconsolemode.md ├── getconsoleoriginaltitle.md ├── getconsoleoutputcp.md ├── getconsoleprocesslist.md ├── getconsolescreenbufferinfo.md ├── getconsolescreenbufferinfoex.md ├── getconsoleselectioninfo.md ├── getconsoletitle.md ├── getconsolewindow.md ├── getcurrentconsolefont.md ├── getcurrentconsolefontex.md ├── getlargestconsolewindowsize.md ├── getnumberofconsoleinputevents.md ├── getnumberofconsolemousebuttons.md ├── getstdhandle.md ├── handlerroutine.md ├── high-level-console-i-o.md ├── high-level-console-input-and-output-functions.md ├── high-level-console-modes.md ├── images ├── command-line-communication.png ├── cscon-01.png ├── cscon-02.png ├── cscon-03.png └── sgr.png ├── includes ├── console-mode-flags.md ├── console-mode-remarks.md ├── no-vt-equiv-alt-buf.md ├── no-vt-equiv-banner.md ├── no-vt-equiv-local-context.md ├── no-vt-equiv-shell-banner.md ├── no-vt-equiv-user-priv.md ├── not-recommended-banner.md └── setting-codepage-mode-remarks.md ├── index.md ├── input-and-output-methods.md ├── input-record-str.md ├── key-event-record-str.md ├── legacymode.md ├── low-level-console-i-o.md ├── low-level-console-input-functions.md ├── low-level-console-modes.md ├── low-level-console-output-functions.md ├── menu-event-record-str.md ├── mouse-event-record-str.md ├── peekconsoleinput.md ├── pseudoconsoles.md ├── readconsole.md ├── readconsoleinput.md ├── readconsoleinputex.md ├── readconsoleoutput.md ├── readconsoleoutputattribute.md ├── readconsoleoutputcharacter.md ├── reading-and-writing-blocks-of-characters-and-attributes.md ├── reading-input-buffer-events.md ├── registering-a-control-handler-function.md ├── resizepseudoconsole.md ├── scrollconsolescreenbuffer.md ├── scrolling-a-screen-buffer-s-contents.md ├── scrolling-a-screen-buffer-s-window.md ├── scrolling-the-screen-buffer.md ├── setconsoleactivescreenbuffer.md ├── setconsolecp.md ├── setconsolectrlhandler.md ├── setconsolecursorinfo.md ├── setconsolecursorposition.md ├── setconsoledisplaymode.md ├── setconsolehistoryinfo.md ├── setconsolemode.md ├── setconsoleoutputcp.md ├── setconsolescreenbufferinfoex.md ├── setconsolescreenbuffersize.md ├── setconsoletextattribute.md ├── setconsoletitle.md ├── setconsolewindowinfo.md ├── setcurrentconsolefontex.md ├── setstdhandle.md ├── small-rect-str.md ├── using-the-console.md ├── using-the-high-level-input-and-output-functions.md ├── window-and-screen-buffer-size.md ├── window-buffer-size-record-str.md ├── writeconsole.md ├── writeconsoleinput.md ├── writeconsoleoutput.md ├── writeconsoleoutputattribute.md └── writeconsoleoutputcharacter.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Explicitly declare text files you want to always be normalized and converted 5 | # to native line endings on checkout. 6 | *.c text 7 | *.h text 8 | 9 | # Declare files that will always have CRLF line endings on checkout. 10 | *.sln text eol=crlf 11 | 12 | # Denote all files that are truly binary and should not be modified. 13 | *.png binary 14 | *.jpg binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | log/ 2 | xhtml/ 3 | packages/ 4 | obj/ 5 | _site/ 6 | Tools/NuGet/ 7 | .optemp/ 8 | 9 | .openpublishing.build.mdproj 10 | .openpublishing.buildcore.ps1 11 | packages.config 12 | 13 | .vs/ 14 | .vscode/ 15 | -------------------------------------------------------------------------------- /.openpublishing.publish.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "docsets_to_publish": [ 3 | { 4 | "docset_name": "console", 5 | "build_source_folder": "docs", 6 | "build_output_subfolder": "console", 7 | "locale": "en-us", 8 | "monikers": [], 9 | "moniker_ranges": [], 10 | "open_to_public_contributors": true, 11 | "type_mapping": { 12 | "Conceptual": "Content", 13 | "ManagedReference": "Content", 14 | "RestApi": "Content" 15 | }, 16 | "build_entry_point": "docs", 17 | "template_folder": "_themes", 18 | "moniker_groups": [], 19 | "version": 0 20 | } 21 | ], 22 | "notification_subscribers": [ 23 | "duhowett@microsoft.com", 24 | "miniksa@microsoft.com", 25 | "cinnamon@microsoft.com" 26 | ], 27 | "sync_notification_subscribers": [], 28 | "branches_to_filter": [ 29 | "" 30 | ], 31 | "git_repository_url_open_to_public_contributors": "https://github.com/Microsoft/Console-Docs", 32 | "git_repository_branch_open_to_public_contributors": "main", 33 | "skip_source_output_uploading": false, 34 | "need_preview_pull_request": true, 35 | "contribution_branch_mappings": {}, 36 | "dependent_repositories": [ 37 | { 38 | "path_to_root": "_themes", 39 | "url": "https://github.com/Microsoft/templates.docs.msft", 40 | "branch": "main", 41 | "branch_mapping": {} 42 | }, 43 | { 44 | "path_to_root": "_themes.pdf", 45 | "url": "https://github.com/Microsoft/templates.docs.msft.pdf", 46 | "branch": "main", 47 | "branch_mapping": {} 48 | } 49 | ], 50 | "branch_target_mapping": { 51 | "live": [ 52 | "Publish", 53 | "Pdf" 54 | ] 55 | }, 56 | "need_generate_pdf_url_template": true, 57 | "targets": { 58 | "pdf": { 59 | "template_folder": "_themes.pdf" 60 | } 61 | }, 62 | "docs_build_engine": { 63 | "name": "docfx_v3" 64 | }, 65 | "need_generate_pdf": false, 66 | "need_generate_intellisense": false 67 | } -------------------------------------------------------------------------------- /LICENSE-CODE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) Microsoft Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, 6 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Windows Console Documentation 2 | 3 | Welcome to the Windows Console documentation repo. The published articles are generated from the markdown stored in this repo and published at [Windows Console documentation](https://learn.microsoft.com/windows/console/). 4 | 5 | For code issues related to the Windows Console, Windows Terminal, and related command-line and terminal tooling products acquired with Windows, from the Windows Store, or other sources like GitHub, please check out the [microsoft/terminal](https://github.com/microsoft/terminal) repository. 6 | 7 | ## Metadata 8 | 9 | Each content page in this repo requires some metadata expressed as [YAML](https://en.wikipedia.org/wiki/YAML), stored at the top of each doc between '---' markers. For example: 10 | 11 | ```yaml 12 | --- 13 | title: About Consoles 14 | description: Consoles provide high-level support for simple character-mode applications that interact with the user by using functions that read from standard input and write to standard output or standard error. 15 | author: miniksa 16 | ms.author: miniksa 17 | ms.assetid: 39204f0e-b0b8-4f92-af8e-e146ac06c454 18 | ms.topic: article 19 | --- 20 | 21 | ## About Consoles 22 | 23 | Consoles provide high-level support for ... 24 | ``` 25 | 26 | Notes on metadata: 27 | 28 | * author: Main article author 29 | * ms.author: Additional co-authors / contributors / editors 30 | * ms.assetid: UUID used by BI for reporting and analysis. Generated by CAPS for existing content, auto-generated by OPS in future 31 | * ms.topic: One of [article | get-started-article | hero-article | hub-page | landing-page | non-content | reference | search] (see [this Excel workbook](https://microsoft.sharepoint.com/teams/STBCSI/Insights/_layouts/15/WopiFrame.aspx?sourcedoc=%7b7A321BF1-0611-4184-84DA-A0E964C435FA%7d&file=WEDCS_MasterList_CSIValues.xlsx&action=default&IsList=1&ListId=%7b46B17C8A-CD7E-47ED-A1B6-F2B654B55E2B%7d&ListItemId=969) (Microsoft employee only link) for current valid values). 32 | 33 | While some metadata is stored per file (like above), common metadata required by all files within a documentation set (docset) is stored in the `docfx.json` file in the root of the `docs` folder. For example: 34 | 35 | ```json 36 | "build": { 37 | #... 38 | "fileMetadata": { 39 | "ms.prod": { "/console/**.yml": "windows"}, 40 | "ms.technology": { "/console/**.yml": "desktop"}, 41 | "manager": {"/console/**.yml": "miniksa"} 42 | } 43 | } 44 | ``` 45 | 46 | The values for `ms.prod` and `ms.technology` are standard for Win32 APIs and desktop technology, as defined in the Excel workbook above. Custom values can be registered if required. 47 | -------------------------------------------------------------------------------- /ThirdPartyNotices: -------------------------------------------------------------------------------- 1 | ##Legal Notices 2 | Microsoft and any contributors grant you a license to the Microsoft documentation and other content 3 | in this repository under the [Creative Commons Attribution 4.0 International Public License](https://creativecommons.org/licenses/by/4.0/legalcode), 4 | see the [LICENSE](LICENSE) file, and grant you a license to any code in the repository under the [MIT License](https://opensource.org/licenses/MIT), see the 5 | [LICENSE-CODE](LICENSE-CODE) file. 6 | 7 | Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation 8 | may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. 9 | The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. 10 | Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653. 11 | 12 | Privacy information can be found at https://privacy.microsoft.com/en-us/ 13 | 14 | Microsoft and any contributors reserve all others rights, whether under their respective copyrights, patents, 15 | or trademarks, whether by implication, estoppel or otherwise. -------------------------------------------------------------------------------- /docs/about-character-mode-applications.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: About Consoles 3 | description: Consoles provide high-level support for simple character mode applications that interact with the user by using functions that read from standard input and write to standard output or standard error. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_about\_character\_mode\_applications' 10 | - 'base.about\_character\_mode\_applications' 11 | - 'consoles.about\_character\_mode\_applications' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 39204f0e-b0b8-4f92-af8e-e146ac06c454 16 | --- 17 | 18 | # About Character Mode Applications 19 | 20 | Character mode (or "command-line") applications: 21 | 22 | 1. \[Optionally\] Read data from standard input (stdin) 23 | 2. Do "work" 24 | 3. \[Optionally\] Write data to standard output (stdout) or standard error (stderr) 25 | 26 | Character mode applications communicate with the end-user through a "console" (or "terminal") application. A console converts user input from keyboard, mouse, touch-screen, pen, etc., and sends it to a character mode application's stdin. A console may also display a character mode application's text output on the user's screen. 27 | 28 | In Windows, the console is built-in and provides a rich API through which character mode applications can interact with the user. However, in the recent era, the console team is encouraging all character mode applications to be developed with [virtual terminal sequences](console-virtual-terminal-sequences.md) over the classic API calls for maximum compatibility between Windows and other operating systems. More details on this transition and the trade offs involved can be found in our discussion of [classic APIs versus virtual terminal sequences](classic-vs-vt.md). 29 | 30 | - [Consoles](consoles.md) 31 | - [Input and Output Methods](input-and-output-methods.md) 32 | - [Console Code Pages](console-code-pages.md) 33 | - [Console Control Handlers](console-control-handlers.md) 34 | - [Console Aliases](console-aliases.md) 35 | - [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md) 36 | - [Console Application Issues](console-application-issues.md) 37 | -------------------------------------------------------------------------------- /docs/addconsolealias.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: AddConsoleAlias function 3 | description: See reference information about the AddConsoleAlias function, which defines a console alias for the specified executable. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/AddConsoleAlias 10 | - consoleapi3/AddConsoleAliasA 11 | - consoleapi3/AddConsoleAliasW 12 | - wincon/AddConsoleAlias 13 | - wincon/AddConsoleAliasA 14 | - wincon/AddConsoleAliasW 15 | - AddConsoleAlias 16 | - AddConsoleAliasA 17 | - AddConsoleAliasW 18 | MS-HAID: 19 | - 'base.addconsolealias' 20 | - 'consoles.addconsolealias' 21 | MSHAttr: 22 | - 'PreferredSiteName:MSDN' 23 | - 'PreferredLib:/library/windows/desktop' 24 | ms.assetid: e4072c3c-cf32-4992-847e-efdb846e5784 25 | topic_type: 26 | - apiref 27 | api_name: 28 | - AddConsoleAlias 29 | - AddConsoleAliasA 30 | - AddConsoleAliasW 31 | api_location: 32 | - Kernel32.dll 33 | api_type: 34 | - DllExport 35 | --- 36 | 37 | # AddConsoleAlias function 38 | 39 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 40 | 41 | Defines a console alias for the specified executable. 42 | 43 | ## Syntax 44 | 45 | ```C 46 | BOOL WINAPI AddConsoleAlias( 47 | _In_ LPCTSTR Source, 48 | _In_ LPCTSTR Target, 49 | _In_ LPCTSTR ExeName 50 | ); 51 | ``` 52 | 53 | ## Parameters 54 | 55 | *Source* \[in\] 56 | The console alias to be mapped to the text specified by *Target*. 57 | 58 | *Target* \[in\] 59 | The text to be substituted for *Source*. If this parameter is **NULL**, then the console alias is removed. 60 | 61 | *ExeName* \[in\] 62 | The name of the executable file for which the console alias is to be defined. 63 | 64 | ## Return value 65 | 66 | If the function succeeds, the return value is **TRUE**. 67 | 68 | If the function fails, the return value is **FALSE**. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 69 | 70 | ## Remarks 71 | 72 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0501 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 73 | 74 | [!INCLUDE [no-vt-equiv-shell-banner](./includes/no-vt-equiv-shell-banner.md)] 75 | 76 | ## Examples 77 | 78 | For an example, see [Console Aliases](console-aliases.md). 79 | 80 | ## Requirements 81 | 82 | |   |   | 83 | |-|-| 84 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 85 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 86 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 87 | | Library | Kernel32.lib | 88 | | DLL | Kernel32.dll | 89 | | Unicode and ANSI names | **AddConsoleAliasW** (Unicode) and **AddConsoleAliasA** (ANSI) | 90 | 91 | ## See also 92 | 93 | [Console Aliases](console-aliases.md) 94 | 95 | [Console Functions](console-functions.md) 96 | 97 | [**GetConsoleAlias**](getconsolealias.md) 98 | 99 | [**GetConsoleAliases**](getconsolealiases.md) 100 | 101 | [**GetConsoleAliasExes**](getconsolealiasexes.md) -------------------------------------------------------------------------------- /docs/allocconsole.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: AllocConsole function 3 | description: See reference information about the AllocConsole function, which allocates a new console for the calling process. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi/AllocConsole 10 | - wincon/AllocConsole 11 | - AllocConsole 12 | MS-HAID: 13 | - '\_win32\_allocconsole' 14 | - 'base.allocconsole' 15 | - 'consoles.allocconsole' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: bdf3bf2f-8eb8-4ba6-bf3a-a67b29dffda2 20 | topic_type: 21 | - apiref 22 | api_name: 23 | - AllocConsole 24 | api_location: 25 | - Kernel32.dll 26 | - API-MS-Win-Core-Console-l1-1-0.dll 27 | - KernelBase.dll 28 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 29 | - MinKernelBase.dll 30 | api_type: 31 | - DllExport 32 | --- 33 | 34 | # AllocConsole function 35 | 36 | Allocates a new console for the calling process. 37 | 38 | ## Syntax 39 | 40 | ```C 41 | BOOL WINAPI AllocConsole(void); 42 | ``` 43 | 44 | ## Parameters 45 | 46 | This function has no parameters. 47 | 48 | ## Return value 49 | 50 | If the function succeeds, the return value is nonzero. 51 | 52 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 53 | 54 | ## Remarks 55 | 56 | A process can be associated with only one console, so the **AllocConsole** function fails if the calling process already has a console. A process can use the [**FreeConsole**](freeconsole.md) function to detach itself from its current console, then it can call **AllocConsole** to create a new console or [**AttachConsole**](attachconsole.md) to attach to another console. 57 | 58 | If the calling process creates a child process, the child inherits the new console. 59 | 60 | **AllocConsole** initializes standard input, standard output, and standard error handles for the new console. The standard input handle is a handle to the console's input buffer, and the standard output and standard error handles are handles to the console's screen buffer. To retrieve these handles, use the [**GetStdHandle**](getstdhandle.md) function. 61 | 62 | This function is primarily used by a graphical user interface (GUI) application to create a console window. GUI applications are initialized without a console. Console applications are initialized with a console, unless they are created as detached processes (by calling the [**CreateProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa) function with the **DETACHED\_PROCESS** flag). 63 | 64 | ## Requirements 65 | 66 | |   |   | 67 | |-|-| 68 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 69 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 70 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 71 | | Library | Kernel32.lib | 72 | | DLL | Kernel32.dll | 73 | 74 | ## See also 75 | 76 | [Console Functions](console-functions.md) 77 | 78 | [Consoles](consoles.md) 79 | 80 | [**AttachConsole**](attachconsole.md) 81 | 82 | [**CreateProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa) 83 | 84 | [**FreeConsole**](freeconsole.md) 85 | 86 | [**GetStdHandle**](getstdhandle.md) 87 | -------------------------------------------------------------------------------- /docs/attaching-to-a-console.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Attaching to a Console 3 | description: A process can use the AttachConsole function to attach to a console. A process can be attached to one console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_attaching\_to\_a\_console' 10 | - 'base.attaching\_to\_a\_console' 11 | - 'consoles.attaching\_to\_a\_console' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 348e572f-2448-4384-9822-fab01d4ba255 16 | --- 17 | 18 | # Attaching to a Console 19 | 20 | A process can use the [**AttachConsole**](attachconsole.md) function to attach to a console as a client. A process can be attached to one console. 21 | 22 | A console can have many processes attached to it. To retrieve a list of the processes attached to a console, call the [**GetConsoleProcessList**](getconsoleprocesslist.md) function. 23 | 24 | To attach as a server, see information about [**Pseudoconsoles**](pseudoconsoles.md). 25 | -------------------------------------------------------------------------------- /docs/breadcrumb/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Docs 2 | tocHref: / 3 | topicHref: / 4 | items: 5 | 6 | - name: Windows Console 7 | tocHref: /windows/console/ 8 | topicHref: /windows/console/index 9 | -------------------------------------------------------------------------------- /docs/char-info-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CHAR_INFO structure 3 | description: Specifies a Unicode or ANSI character and its attributes. This structure is used by console functions to read from and write to a console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - wincontypes/CHAR_INFO 10 | - wincon/CHAR_INFO 11 | - CHAR_INFO 12 | - wincontypes/PCHAR_INFO 13 | - wincon/PCHAR_INFO 14 | - PCHAR_INFO 15 | MS-HAID: 16 | - '\_win32\_char\_info\_str' 17 | - 'base.char\_info\_str' 18 | - 'consoles.char\_info\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: 5574a862-b262-41af-8862-e9837c5c7b5f 23 | topic_type: 24 | - apiref 25 | api_name: 26 | - CHAR_INFO 27 | api_location: 28 | - WinCon.h 29 | api_type: 30 | - HeaderDef 31 | --- 32 | 33 | # CHAR\_INFO structure 34 | 35 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 36 | 37 | Specifies a Unicode or ANSI character and its attributes. This structure is used by console functions to read from and write to a console screen buffer. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | typedef struct _CHAR_INFO { 43 | union { 44 | WCHAR UnicodeChar; 45 | CHAR  AsciiChar; 46 | } Char; 47 | WORD  Attributes; 48 | } CHAR_INFO, *PCHAR_INFO; 49 | ``` 50 | 51 | ## Members 52 | 53 | **Char** 54 | A union of the following members. 55 | 56 | **UnicodeChar** 57 | Unicode character of a screen buffer character cell. 58 | 59 | **AsciiChar** 60 | ANSI character of a screen buffer character cell. 61 | 62 | **Attributes** 63 | The character attributes. This member can be zero or any combination of the following values. 64 | 65 | | Value | Meaning | 66 | |-|-| 67 | | **FOREGROUND_BLUE** `0x0001` | Text color contains blue. | 68 | | **FOREGROUND_GREEN** `0x0002` | Text color contains green. | 69 | | **FOREGROUND_RED** `0x0004` | Text color contains red. | 70 | | **FOREGROUND_INTENSITY** `0x0008` | Text color is intensified. | 71 | | **BACKGROUND_BLUE** `0x0010` | Background color contains blue. | 72 | | **BACKGROUND_GREEN** `0x0020` | Background color contains green. | 73 | | **BACKGROUND_RED** `0x0040` | Background color contains red. | 74 | | **BACKGROUND_INTENSITY** `0x0080` | Background color is intensified. | 75 | | **COMMON_LVB_LEADING_BYTE** `0x0100` | Leading byte. | 76 | | **COMMON_LVB_TRAILING_BYTE** `0x0200` | Trailing byte. | 77 | | **COMMON_LVB_GRID_HORIZONTAL** `0x0400` | Top horizontal. | 78 | | **COMMON_LVB_GRID_LVERTICAL** `0x0800` | Left vertical. | 79 | | **COMMON_LVB_GRID_RVERTICAL** `0x1000` | Right vertical. | 80 | | **COMMON_LVB_REVERSE_VIDEO** `0x4000` | Reverse foreground and background attribute. | 81 | | **COMMON_LVB_UNDERSCORE** `0x8000` | Underscore. | 82 | 83 | ## Examples 84 | 85 | For an example, see [Scrolling a Screen Buffer's Contents](scrolling-a-screen-buffer-s-contents.md). 86 | 87 | ## Requirements 88 | 89 | |   |   | 90 | |-|-| 91 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 92 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 93 | | Header | WinCon.h (include Windows.h) | 94 | 95 | ## See also 96 | 97 | [**ReadConsoleOutput**](readconsoleoutput.md) 98 | 99 | [**ScrollConsoleScreenBuffer**](scrollconsolescreenbuffer.md) 100 | 101 | [**WriteConsoleOutput**](writeconsoleoutput.md) 102 | -------------------------------------------------------------------------------- /docs/character-mode-applications.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Character Mode Applications 3 | description: Consoles manage input and output (I/O) for character-mode applications (applications that do not provide their own graphical user interface). 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_character\_mode\_applications' 10 | - 'base.character\_mode\_applications' 11 | - 'consoles.character\_mode\_applications' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: ea3ea214-892c-4953-bc22-7905efbc173f 16 | --- 17 | 18 | # Character Mode Applications 19 | 20 | Consoles manage input and output (I/O) for character-mode applications (applications that do not provide their own graphical user interface). 21 | 22 | The console functions enable different levels of access to a console. The high-level console I/O functions enable an application to read from standard input to retrieve keyboard input stored in a console's input buffer. The functions also enable an application to write to standard output or standard error to display text in the console's screen buffer. The high-level functions also support redirection of standard handles and control of console modes for different I/O functionality. The low-level console I/O functions enable applications to receive detailed input about keyboard and mouse events, as well as events involving user interactions with the console window. The low-level functions also enable greater control of output to the screen. 23 | 24 | This overview describes support for character-mode applications. 25 | 26 | - [About Consoles](about-character-mode-applications.md) 27 | - [Using the Console](using-the-console.md) 28 | - [Console Reference](console-reference.md) 29 | -------------------------------------------------------------------------------- /docs/closepseudoconsole.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ClosePseudoConsole function 3 | description: See reference information about the ClosePseudoConsole function, which closes a pseudoconsole from the given handle. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api, conpty, pseudoconsole 8 | topic_type: 9 | - apiref 10 | api_name: 11 | - ClosePseudoConsole 12 | api_location: 13 | - Kernel32.dll 14 | - API-MS-Win-Core-Console-l1-2-1.dll 15 | - KernelBase.dll 16 | api_type: 17 | - DllExport 18 | --- 19 | 20 | # ClosePseudoConsole function 21 | 22 | Closes a pseudoconsole from the given handle. 23 | 24 | ## Syntax 25 | 26 | ```C 27 | void WINAPI ClosePseudoConsole( 28 | _In_ HPCON hPC 29 | ); 30 | ``` 31 | 32 | ## Parameters 33 | 34 | *hPC* \[in\] 35 | A handle to an active pseudoconsole as opened by [CreatePseudoConsole](createpseudoconsole.md). 36 | 37 | ## Return value 38 | 39 | *none* 40 | 41 | ## Remarks 42 | 43 | Upon closing a pseudoconsole, client applications attached to the session will be terminated as well. 44 | 45 | A final painted frame may arrive on the `hOutput` handle originally provided to [CreatePseudoConsole](createpseudoconsole.md) when this API is called. It is expected that the caller will drain this information from the communication channel buffer and either present it or discard it. Failure to drain the buffer may cause the Close call to wait indefinitely until it is drained or the communication channels are broken another way. 46 | 47 | ## Requirements 48 | 49 | |   |   | 50 | |-|-| 51 | | Minimum supported client | Windows 10 October 2018 Update (version 1809) \[desktop apps only\] | 52 | | Minimum supported server | Windows Server 2019 \[desktop apps only\] | 53 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 54 | | Library | Kernel32.lib | 55 | | DLL | Kernel32.dll | 56 | 57 | ## See also 58 | 59 | [Pseudoconsoles](pseudoconsoles.md) 60 | 61 | [**CreatePseudoConsole**](createpseudoconsole.md) 62 | 63 | [**ResizePseudoConsole**](resizepseudoconsole.md) 64 | -------------------------------------------------------------------------------- /docs/closing-a-console.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Closing a Console 3 | description: A process can use the FreeConsole function to detach itself from its console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_closing\_a\_console' 10 | - 'base.closing\_a\_console' 11 | - 'consoles.closing\_a\_console' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 254b7cfc-4dee-452f-a409-4fc90d20d4c1 16 | --- 17 | 18 | # Closing a Console 19 | 20 | A process can use the [**FreeConsole**](freeconsole.md) function to detach itself from its console. If other processes share the console, the console is not destroyed, but the process that called **FreeConsole** cannot refer to it. After calling **FreeConsole**, the process can use [**AllocConsole**](allocconsole.md) to create a new console or [**AttachConsole**](attachconsole.md) to attach to another console. 21 | 22 | A console is closed when the last process attached to it terminates or calls [**FreeConsole**](freeconsole.md). 23 | -------------------------------------------------------------------------------- /docs/console-aliases.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Console Aliases 3 | description: Describes console aliases and how they are used to map source strings to target strings. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - 'base.console\_aliases' 10 | - 'consoles.console\_aliases' 11 | MSHAttr: 12 | - 'PreferredSiteName:MSDN' 13 | - 'PreferredLib:/library/windows/desktop' 14 | ms.assetid: 8169708b-83da-47ef-94be-eca3ca7d0a5b 15 | --- 16 | 17 | # Console Aliases 18 | 19 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 20 | 21 | Console aliases are used to map source strings to target strings. For example, you can define a console alias that maps "test" to "cd \\a\_very\_long\_path\\test". When you type "test" at the command line, the console subsystem expands the alias and executes the specified cd command. 22 | 23 | To define a console alias, use [**Doskey.exe**](/windows-server/administration/windows-commands/doskey) to create a macro, or use the [**AddConsoleAlias**](addconsolealias.md) function. The following example uses `Doskey.exe`: 24 | 25 | **doskey test=cd \\**a\_very\_long\_path**\\test** 26 | 27 | The following call to [**AddConsoleAlias**](addconsolealias.md) creates the same console alias: 28 | 29 | ``` C 30 | AddConsoleAlias( TEXT("test"), 31 | TEXT("cd \\\\test"), 32 | TEXT("cmd.exe")); 33 | ``` 34 | 35 | To add parameters to a console alias macro using `Doskey.exe`, use the batch parameters `$1` through `$9`. For more information on the special codes that can be used in Doskey macro definitions, see the command-line help for `Doskey.exe` or [Doskey](/previous-versions/windows/it-pro/windows-xp/bb490894(v=technet.10)) on TechNet. 36 | 37 | All instances of an executable file running in the same console window share any defined console aliases. Multiple instances of the same executable file running in different console windows do not share console aliases. Different executable files running in the same console window do not share console aliases. 38 | 39 | To retrieve the target string for a specified source string and executable file, use the [**GetConsoleAlias**](getconsolealias.md) function. To retrieve all aliases for a specified executable file, use the [**GetConsoleAliases**](getconsolealiases.md) function. To retrieve the names of all aliases for which console aliases have been defined, use the [**GetConsoleAliasExes**](getconsolealiasexes.md) function. -------------------------------------------------------------------------------- /docs/console-code-pages.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Console Code Pages 3 | description: A code page is a mapping of 256 character codes to individual characters. Different code pages include different special characters, typically customized for a language or a group of languages. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_console\_code\_pages' 10 | - 'base.console\_code\_pages' 11 | - 'consoles.console\_code\_pages' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 98d56bb1-83d2-40aa-adac-fc2e8beab337 16 | --- 17 | 18 | # Console Code Pages 19 | 20 | A *code page* is a mapping of 256 character codes to individual characters. Different code pages include different special characters, typically customized for a language or a group of languages. 21 | 22 | Associated with each console are two code pages: one for input and one for output. A console uses its input code page to translate keyboard input into the corresponding character value. It uses its output code page to translate the character values written by the various output functions into the images displayed in the console window. An application can use the [**SetConsoleCP**](setconsolecp.md) and [**GetConsoleCP**](getconsolecp.md) functions to set and retrieve a console's input code pages and the [**SetConsoleOutputCP**](setconsoleoutputcp.md) and [**GetConsoleOutputCP**](getconsoleoutputcp.md) functions to set and retrieve its output code pages. 23 | 24 | The identifiers of the code pages available on the local computer are stored in the registry under the following key: 25 | `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage` 26 | 27 | For information about using the registry functions to determine the available code pages, see [**Registry**](/windows/win32/sysinfo/registry). 28 | 29 | > [!TIP] 30 | > It is recommended for all new and updated command-line applications to avoid code pages and use **[Unicode](/windows/win32/intl/unicode)**. UTF-16 formatted text can be sent to the *W* family of console APIs. UTF-8 formatted text can be sent to the *A* family of console APIs after ensuring the code page is first set to **[65001 (CP_UTF8)](/windows/win32/intl/code-page-identifiers)** with the [**SetConsoleCP**](setconsolecp.md) and [**SetConsoleOutputCP**](setconsoleoutputcp.md) functions. -------------------------------------------------------------------------------- /docs/console-control-handlers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Console Control Handlers 3 | description: Each console process has its own list of control handler functions that are called by the system when the process receives a CTRL+C, CTRL+BREAK, or CTRL+CLOSE signal. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_console\_control\_handlers' 10 | - 'base.console\_control\_handlers' 11 | - 'consoles.console\_control\_handlers' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 6480e8ee-d228-4c07-99df-de1e0c3ca250 16 | --- 17 | 18 | # Console Control Handlers 19 | 20 | Each console process has its own list of control handler functions that are called by the system when the process receives a [CTRL+C](ctrl-c-and-ctrl-break-signals.md), [CTRL+BREAK](ctrl-c-and-ctrl-break-signals.md), or [CTRL+CLOSE](ctrl-close-signal.md) signal. Initially, the list of control handlers for each process contains only a default handler function that calls the [**ExitProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess) function. A console process can add or remove additional [**HandlerRoutine**](handlerroutine.md) functions by calling the [**SetConsoleCtrlHandler**](setconsolectrlhandler.md) function. This function does not affect the lists of control handlers for other processes. When a console process receives any of the control signals, it calls the handler functions on a last-registered, first-called basis until one of the handlers returns **TRUE**. If none of the handlers returns **TRUE**, the default handler is called. 21 | 22 | The function's *dwCtrlType* parameter identifies which control signal was received, and the return value indicates whether the signal was handled. 23 | 24 | A new thread is started inside the command-line client process to run the handler routines. More information on the timeout values and action of this thread can be found in the [**HandlerRoutine**](handlerroutine.md#remarks) function documentation. 25 | 26 | For an example of a control handler function, see [Registering a Control Handler Function](registering-a-control-handler-function.md). 27 | 28 | Note that calling [**AttachConsole**](attachconsole.md), [**AllocConsole**](allocconsole.md), or [**FreeConsole**](freeconsole.md) will reset the table of control handlers in the client process to its initial state. 29 | -------------------------------------------------------------------------------- /docs/console-cursor-info-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CONSOLE_CURSOR_INFO structure 3 | description: Contains the size and visibility information about the about the console cursor. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - wincontypes/CONSOLE_CURSOR_INFO 10 | - wincon/CONSOLE_CURSOR_INFO 11 | - CONSOLE_CURSOR_INFO 12 | - wincontypes/PCONSOLE_CURSOR_INFO 13 | - wincon/PCONSOLE_CURSOR_INFO 14 | - PCONSOLE_CURSOR_INFO 15 | MS-HAID: 16 | - '\_win32\_console\_cursor\_info\_str' 17 | - 'base.console\_cursor\_info\_str' 18 | - 'consoles.console\_cursor\_info\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: 0e71ce8c-e008-4bd7-922e-c44484b425ef 23 | 24 | topic_type: 25 | - apiref 26 | api_name: 27 | - CONSOLE_CURSOR_INFO 28 | api_location: 29 | - WinCon.h 30 | api_type: 31 | - HeaderDef 32 | --- 33 | 34 | # CONSOLE\_CURSOR\_INFO structure 35 | 36 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 37 | 38 | Contains information about the console cursor. 39 | 40 | ## Syntax 41 | 42 | ```C 43 | typedef struct _CONSOLE_CURSOR_INFO { 44 | DWORD dwSize; 45 | BOOL  bVisible; 46 | } CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO; 47 | ``` 48 | 49 | ## Members 50 | 51 | **dwSize** 52 | The percentage of the character cell that is filled by the cursor. This value is between 1 and 100. The cursor appearance varies, ranging from completely filling the cell to showing up as a horizontal line at the bottom of the cell. 53 | 54 | > [!NOTE] 55 | >While the **dwSize** value is normally between 1 and 100, under some circumstances a value outside of that range might be returned. For example, if **CursorSize** is set to 0 in the registry, the **dwSize** value returned would be 0. 56 | 57 |  **bVisible** 58 | The visibility of the cursor. If the cursor is visible, this member is **TRUE**. 59 | 60 | ## Requirements 61 | 62 | |   |   | 63 | |-|-| 64 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 65 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 66 | | Header | WinCon.h (include Windows.h) | 67 | 68 | ## See also 69 | 70 | [**GetConsoleCursorInfo**](getconsolecursorinfo.md) 71 | 72 | [**SetConsoleCursorInfo**](setconsolecursorinfo.md) 73 | -------------------------------------------------------------------------------- /docs/console-font-info-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CONSOLE_FONT_INFO structure 3 | description: See reference information about the CONSOLE_FONT_INFO structure, which contains the index and size for a console font. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - wincontypes/CONSOLE_FONT_INFO 10 | - wincon/CONSOLE_FONT_INFO 11 | - CONSOLE_FONT_INFO 12 | - wincontypes/PCONSOLE_FONT_INFO 13 | - wincon/PCONSOLE_FONT_INFO 14 | - PCONSOLE_FONT_INFO 15 | MS-HAID: 16 | - '\_win32\_console\_font\_info\_str' 17 | - 'base.console\_font\_info\_str' 18 | - 'consoles.console\_font\_info\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: 380b8183-1964-46f2-a511-01f39f21f5c5 23 | topic_type: 24 | - apiref 25 | api_name: 26 | - CONSOLE_FONT_INFO 27 | api_location: 28 | - WinCon.h 29 | api_type: 30 | - HeaderDef 31 | --- 32 | 33 | # CONSOLE\_FONT\_INFO structure 34 | 35 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 36 | 37 | Contains information for a console font. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | typedef struct _CONSOLE_FONT_INFO { 43 | DWORD nFont; 44 | COORD dwFontSize; 45 | } CONSOLE_FONT_INFO, *PCONSOLE_FONT_INFO; 46 | ``` 47 | 48 | ## Members 49 | 50 | **nFont** 51 | The index of the font in the system's console font table. 52 | 53 | **dwFontSize** 54 | A [**COORD**](coord-str.md) structure that contains the width and height of each character in the font, in logical units. The **X** member contains the width, while the **Y** member contains the height. 55 | 56 | ## Remarks 57 | 58 | To obtain the size of the font, pass the font index to the [**GetConsoleFontSize**](getconsolefontsize.md) function. 59 | 60 | ## Requirements 61 | 62 | |   |   | 63 | |-|-| 64 | | Minimum supported client | Windows XP \[desktop apps only\] | 65 | | Minimum supported server | Windows Server 2003 \[desktop apps only\] | 66 | | Header | WinCon.h (include Windows.h) | 67 | 68 | ## See also 69 | 70 | [**COORD**](coord-str.md) 71 | 72 | [**GetCurrentConsoleFont**](getcurrentconsolefont.md) 73 | -------------------------------------------------------------------------------- /docs/console-font-infoex.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CONSOLE_FONT_INFOEX structure 3 | description: See reference information about the CONSOLE_FONT_INFOEX structure, which contains extended information for a console font. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/CONSOLE_FONT_INFOEX 10 | - wincon/CONSOLE_FONT_INFOEX 11 | - CONSOLE_FONT_INFOEX 12 | - consoleapi3/PCONSOLE_FONT_INFOEX 13 | - wincon/PCONSOLE_FONT_INFOEX 14 | - PCONSOLE_FONT_INFOEX 15 | MS-HAID: 16 | - 'base.console\_font\_infoex' 17 | - 'consoles.console\_font\_infoex' 18 | MSHAttr: 19 | - 'PreferredSiteName:MSDN' 20 | - 'PreferredLib:/library/windows/desktop' 21 | ms.assetid: e9a087e1-264d-4d48-8adb-771a0e35b511 22 | 23 | topic_type: 24 | - apiref 25 | api_name: 26 | - CONSOLE_FONT_INFOEX 27 | api_location: 28 | - WinCon.h 29 | api_type: 30 | - HeaderDef 31 | --- 32 | 33 | # CONSOLE\_FONT\_INFOEX structure 34 | 35 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 36 | 37 | Contains extended information for a console font. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | typedef struct _CONSOLE_FONT_INFOEX { 43 | ULONG cbSize; 44 | DWORD nFont; 45 | COORD dwFontSize; 46 | UINT  FontFamily; 47 | UINT  FontWeight; 48 | WCHAR FaceName[LF_FACESIZE]; 49 | } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX; 50 | ``` 51 | 52 | ## Members 53 | 54 | **cbSize** 55 | The size of this structure, in bytes. This member must be set to `sizeof(CONSOLE_FONT_INFOEX)` before calling [**GetCurrentConsoleFontEx**](getcurrentconsolefontex.md) or it will fail. 56 | 57 | **nFont** 58 | The index of the font in the system's console font table. 59 | 60 | **dwFontSize** 61 | A [**COORD**](coord-str.md) structure that contains the width and height of each character in the font, in logical units. The **X** member contains the width, while the **Y** member contains the height. 62 | 63 | **FontFamily** 64 | The font pitch and family. For information about the possible values for this member, see the description of the **tmPitchAndFamily** member of the [**TEXTMETRIC**](/windows/win32/api/wingdi/ns-wingdi-textmetrica) structure. 65 | 66 | **FontWeight** 67 | The font weight. The weight can range from 100 to 1000, in multiples of 100. For example, the normal weight is 400, while 700 is bold. 68 | 69 | **FaceName** 70 | The name of the typeface (such as Courier or Arial). 71 | 72 | ## Remarks 73 | 74 | To obtain the size of the font, pass the font index to the [**GetConsoleFontSize**](getconsolefontsize.md) function. 75 | 76 | ## Requirements 77 | 78 | |   |   | 79 | |-|-| 80 | | Minimum supported client | Windows Vista \[desktop apps only\] | 81 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 82 | | Header | WinCon.h (include Windows.h) | 83 | 84 | ## See also 85 | 86 | [**GetCurrentConsoleFontEx**](getcurrentconsolefontex.md) -------------------------------------------------------------------------------- /docs/console-history-info.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CONSOLE_HISTORY_INFO structure 3 | description: See reference information about the CONSOLE_HISTORY_INFO structure, which contains information about the console history. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/CONSOLE_HISTORY_INFO 10 | - wincon/CONSOLE_HISTORY_INFO 11 | - CONSOLE_HISTORY_INFO 12 | - consoleapi3/PCONSOLE_HISTORY_INFO 13 | - wincon/PCONSOLE_HISTORY_INFO 14 | - PCONSOLE_HISTORY_INFO 15 | MS-HAID: 16 | - 'base.console\_history\_info' 17 | - 'consoles.console\_history\_info' 18 | MSHAttr: 19 | - 'PreferredSiteName:MSDN' 20 | - 'PreferredLib:/library/windows/desktop' 21 | ms.assetid: df7d2f12-5299-47ed-b1f6-2db903dba81b 22 | 23 | topic_type: 24 | - apiref 25 | api_name: 26 | - CONSOLE_HISTORY_INFO 27 | api_location: 28 | - WinCon.h 29 | api_type: 30 | - HeaderDef 31 | --- 32 | 33 | # CONSOLE\_HISTORY\_INFO structure 34 | 35 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 36 | 37 | Contains information about the console history. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | typedef struct { 43 | UINT  cbSize; 44 | UINT  HistoryBufferSize; 45 | UINT  NumberOfHistoryBuffers; 46 | DWORD dwFlags; 47 | } CONSOLE_HISTORY_INFO, *PCONSOLE_HISTORY_INFO; 48 | ``` 49 | 50 | ## Members 51 | 52 | **cbSize** 53 | The size of the structure, in bytes. Set this member to `sizeof(CONSOLE_HISTORY_INFO)`. 54 | 55 | **HistoryBufferSize** 56 | The number of commands kept in each history buffer. 57 | 58 | **NumberOfHistoryBuffers** 59 | The number of history buffers kept for this console process. 60 | 61 | **dwFlags** 62 | This parameter can be zero or the following value. 63 | 64 | | Value | Meaning | 65 | |-|-| 66 | | **HISTORY_NO_DUP_FLAG** 0x1 | Duplicate entries will not be stored in the history buffer. 67 | 68 | ## Requirements 69 | 70 | |   |   | 71 | |-|-| 72 | | Minimum supported client | Windows Vista \[desktop apps only\] | 73 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 74 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 75 | 76 | ## See also 77 | 78 | [**GetConsoleHistoryInfo**](getconsolehistoryinfo.md) 79 | 80 | [**SetConsoleHistoryInfo**](setconsolehistoryinfo.md) 81 | -------------------------------------------------------------------------------- /docs/console-modes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Console Modes 3 | description: Associated with each console input buffer is a set of input modes that affects input operations. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_console\_modes' 10 | - 'base.console\_modes' 11 | - 'consoles.console\_modes' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: f0dcc123-3b12-44c4-8f94-920203f5198e 16 | --- 17 | 18 | # Console Modes 19 | 20 | Associated with each console input buffer is a set of input modes that affects input operations. Similarly, each console screen buffer has a set of output modes that affects output operations. The input modes can be divided into two groups: those that affect the high-level input functions and those that affect the low-level input functions. The output modes only affect applications that use the high-level output functions. 21 | 22 | The [**GetConsoleMode**](getconsolemode.md) function reports the current input mode of a console's input buffer or the current output mode of a screen buffer. The [**SetConsoleMode**](setconsolemode.md) function sets the current mode of either a console input buffer or a screen buffer. If a console has multiple screen buffers, the output modes of each can be different. An application can change I/O modes at any time. For more information about the console modes that affect high-level and low-level I/O operations, see [High-Level Console Modes](high-level-console-modes.md) and [Low-Level Console Modes](low-level-console-modes.md). 23 | 24 | A command-line application should expect that other command-line applications may change the console mode at any time and may not restore it to its original form before control is returned. Additionally, we recommend that all command-line applications should capture the initial console mode at startup and attempt to restore it when exiting to ensure minimal impact on other command-line applications attached to the same console. 25 | 26 | The [**GetConsoleDisplayMode**](getconsoledisplaymode.md) function reports whether the current console is in full-screen mode. 27 | -------------------------------------------------------------------------------- /docs/console-process-groups.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Console Process Groups 3 | description: When a process uses the CreateProcess function to create a new console process, it can specify the CREATE\_NEW\_PROCESS\_GROUP flag to make the new process the root process of a console process group. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_console\_process\_groups' 10 | - 'base.console\_process\_groups' 11 | - 'consoles.console\_process\_groups' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 6cfe5b4b-d677-4747-bbf2-c7243db2346e 16 | --- 17 | 18 | # Console Process Groups 19 | 20 | When a process uses the [**CreateProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa) function to create a new console process, it can specify the **CREATE\_NEW\_PROCESS\_GROUP** flag to make the new process the root process of a console process group. The process group includes all processes that are descendants of the root process. 21 | 22 | A process can use the [**GenerateConsoleCtrlEvent**](generateconsolectrlevent.md) function to send a CTRL+C or CTRL+BREAK signal to all processes in a console process group. The signal is only received by those processes in the group that are attached to the same console as the process that called **GenerateConsoleCtrlEvent**. -------------------------------------------------------------------------------- /docs/console-readconsole-control.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CONSOLE_READCONSOLE_CONTROL structure 3 | description: See reference information about the CONSOLE_READCONSOLE_CONTROL structure, which contains information for a console read operation. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi/CONSOLE_READCONSOLE_CONTROL 10 | - wincon/CONSOLE_READCONSOLE_CONTROL 11 | - CONSOLE_READCONSOLE_CONTROL 12 | - consoleapi/PCONSOLE_READCONSOLE_CONTROL 13 | - wincon/PCONSOLE_READCONSOLE_CONTROL 14 | - PCONSOLE_READCONSOLE_CONTROL 15 | MS-HAID: 16 | - 'base.console\_readconsole\_control' 17 | - 'consoles.console\_readconsole\_control' 18 | MSHAttr: 19 | - 'PreferredSiteName:MSDN' 20 | - 'PreferredLib:/library/windows/desktop' 21 | ms.assetid: 6a8451a6-d692-43af-88c4-972c4dc5e07c 22 | 23 | topic_type: 24 | - apiref 25 | api_name: 26 | - CONSOLE_READCONSOLE_CONTROL 27 | api_location: 28 | - WinCon.h 29 | api_type: 30 | - HeaderDef 31 | --- 32 | 33 | # CONSOLE\_READCONSOLE\_CONTROL structure 34 | 35 | Contains information for a console read operation. 36 | 37 | ## Syntax 38 | 39 | ```C 40 | typedef struct _CONSOLE_READCONSOLE_CONTROL { 41 | ULONG nLength; 42 | ULONG nInitialChars; 43 | ULONG dwCtrlWakeupMask; 44 | ULONG dwControlKeyState; 45 | } CONSOLE_READCONSOLE_CONTROL, *PCONSOLE_READCONSOLE_CONTROL; 46 | ``` 47 | 48 | ## Members 49 | 50 | **nLength** 51 | The size of the structure. Set this member to `sizeof(CONSOLE_READCONSOLE_CONTROL)`. 52 | 53 | **nInitialChars** 54 | The number of characters to skip (and thus preserve) before writing newly read input in the buffer passed to the [**ReadConsole**](readconsole.md) function. This value must be less than the *nNumberOfCharsToRead* parameter of the **ReadConsole** function. 55 | 56 | **dwCtrlWakeupMask** 57 | A mask specifying which control characters between `0x00` and `0x1F` should be used to signal that the read is complete. Each bit corresponds to a character with the least significant bit corresponding to `0x00` or `NUL` and the most significant bit corresponding to `0x1F` or `US`. Multiple bits (control characters) can be specified. 58 | 59 | **dwControlKeyState** 60 | The state of the control keys. This member can be one or more of the following values. 61 | 62 | | Value | Meaning | 63 | |-|-| 64 | | **CAPSLOCK_ON** 0x0080 | The CAPS LOCK light is on. | 65 | | **ENHANCED_KEY** 0x0100 | The key is enhanced. See [remarks](key-event-record-str.md#remarks). | 66 | | **LEFT_ALT_PRESSED** 0x0002 | The left ALT key is pressed. | 67 | | **LEFT_CTRL_PRESSED** 0x0008 | The left CTRL key is pressed. | 68 | | **NUMLOCK_ON** 0x0020 | The NUM LOCK light is on. | 69 | | **RIGHT_ALT_PRESSED** 0x0001 | The right ALT key is pressed. | 70 | | **RIGHT_CTRL_PRESSED** 0x0004 | The right CTRL key is pressed. | 71 | | **SCROLLLOCK_ON** 0x0040 | The SCROLL LOCK light is on. | 72 | | **SHIFT_PRESSED** 0x0010 | The SHIFT key is pressed. | 73 | 74 | ## Requirements 75 | 76 | |   |   | 77 | |-|-| 78 | | Minimum supported client | Windows Vista \[desktop apps only\] | 79 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 80 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 81 | 82 | ## See also 83 | 84 | [**ReadConsole**](readconsole.md) 85 | -------------------------------------------------------------------------------- /docs/console-reference.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Console Reference 3 | description: Describes the three sections of the Console API, console functions, structures, and WinEvents. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: reference 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_console\_reference' 10 | - 'base.console\_reference' 11 | - 'consoles.console\_reference' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: be1aa828-04dc-4d9d-ae88-92842dcafa85 16 | --- 17 | 18 | # Console Reference 19 | 20 | The following sections describe the Console API: 21 | 22 | - [Console Functions](console-functions.md) 23 | - [Console Structures](console-structures.md) 24 | - [Console WinEvents](console-winevents.md) 25 | -------------------------------------------------------------------------------- /docs/console-screen-buffer-info-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CONSOLE_SCREEN_BUFFER_INFO structure 3 | description: See reference information about the CONSOLE_SCREEN_BUFFER_INFO structure, which contains information about a console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/CONSOLE_SCREEN_BUFFER_INFO 10 | - wincon/CONSOLE_SCREEN_BUFFER_INFO 11 | - CONSOLE_SCREEN_BUFFER_INFO 12 | - consoleapi2/PCONSOLE_SCREEN_BUFFER_INFO 13 | - wincon/PCONSOLE_SCREEN_BUFFER_INFO 14 | - PCONSOLE_SCREEN_BUFFER_INFO 15 | MS-HAID: 16 | - '\_win32\_console\_screen\_buffer\_info\_str' 17 | - 'base.console\_screen\_buffer\_info\_str' 18 | - 'consoles.console\_screen\_buffer\_info\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: 586b3e0f-2f6b-4a03-b8e4-602a892be56d 23 | 24 | topic_type: 25 | - apiref 26 | api_name: 27 | - CONSOLE_SCREEN_BUFFER_INFO 28 | api_location: 29 | - WinCon.h 30 | api_type: 31 | - HeaderDef 32 | --- 33 | 34 | # CONSOLE\_SCREEN\_BUFFER\_INFO structure 35 | 36 | Contains information about a console screen buffer. 37 | 38 | ## Syntax 39 | 40 | ```C 41 | typedef struct _CONSOLE_SCREEN_BUFFER_INFO { 42 | COORD      dwSize; 43 | COORD      dwCursorPosition; 44 | WORD       wAttributes; 45 | SMALL_RECT srWindow; 46 | COORD      dwMaximumWindowSize; 47 | } CONSOLE_SCREEN_BUFFER_INFO; 48 | ``` 49 | 50 | ## Members 51 | 52 | **dwSize** 53 | A [**COORD**](coord-str.md) structure that contains the size of the console screen buffer, in character columns and rows. 54 | 55 | **dwCursorPosition** 56 | A [**COORD**](coord-str.md) structure that contains the column and row coordinates of the cursor in the console screen buffer. 57 | 58 | **wAttributes** 59 | The attributes of the characters written to a screen buffer by the [**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile) and [**WriteConsole**](writeconsole.md) functions, or echoed to a screen buffer by the [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) and [**ReadConsole**](readconsole.md) functions. For more information, see [Character Attributes](console-screen-buffers.md#character-attributes). 60 | 61 | **srWindow** 62 | A [**SMALL\_RECT**](small-rect-str.md) structure that contains the console screen buffer coordinates of the upper-left and lower-right corners of the display window. 63 | 64 | **dwMaximumWindowSize** 65 | A [**COORD**](coord-str.md) structure that contains the maximum size of the console window, in character columns and rows, given the current screen buffer size and font and the screen size. 66 | 67 | ## Examples 68 | 69 | For an example, see [Scrolling a Screen Buffer's Contents](scrolling-a-screen-buffer-s-contents.md). 70 | 71 | ## Requirements 72 | 73 | |   |   | 74 | |-|-| 75 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 76 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 77 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 78 | 79 | ## See also 80 | 81 | [**COORD**](coord-str.md) 82 | 83 | [**GetConsoleScreenBufferInfo**](getconsolescreenbufferinfo.md) 84 | 85 | [**ReadConsole**](readconsole.md) 86 | 87 | [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) 88 | 89 | [**SMALL\_RECT**](small-rect-str.md) 90 | 91 | [**WriteConsole**](writeconsole.md) 92 | 93 | [**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile) -------------------------------------------------------------------------------- /docs/console-selection-info-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CONSOLE_SELECTION_INFO structure 3 | description: See reference information about the CONSOLE_SELECTION_INFO structure, which contains information for a console selection. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/CONSOLE_SELECTION_INFO 10 | - wincon/CONSOLE_SELECTION_INFO 11 | - CONSOLE_SELECTION_INFO 12 | - consoleapi3/PCONSOLE_SELECTION_INFO 13 | - wincon/PCONSOLE_SELECTION_INFO 14 | - PCONSOLE_SELECTION_INFO 15 | MS-HAID: 16 | - '\_win32\_console\_selection\_info\_str' 17 | - 'base.console\_selection\_info\_str' 18 | - 'consoles.console\_selection\_info\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: 9530b249-8db4-4516-9cc8-2b452c6751f9 23 | 24 | topic_type: 25 | - apiref 26 | api_name: 27 | - CONSOLE_SELECTION_INFO 28 | api_location: 29 | - WinCon.h 30 | api_type: 31 | - HeaderDef 32 | --- 33 | 34 | # CONSOLE\_SELECTION\_INFO structure 35 | 36 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 37 | 38 | Contains information for a console selection. 39 | 40 | ## Syntax 41 | 42 | ```C 43 | typedef struct _CONSOLE_SELECTION_INFO { 44 | DWORD      dwFlags; 45 | COORD      dwSelectionAnchor; 46 | SMALL_RECT srSelection; 47 | } CONSOLE_SELECTION_INFO, *PCONSOLE_SELECTION_INFO; 48 | ``` 49 | 50 | ## Members 51 | 52 | **dwFlags** 53 | The selection indicator. This member can be one or more of the following values. 54 | 55 | | Value | Meaning | 56 | |-|-| 57 | | **CONSOLE_MOUSE_DOWN** 0x0008 | Mouse is down. The user is actively adjusting the selection rectangle with a mouse. | 58 | | **CONSOLE_MOUSE_SELECTION** 0x0004 | Selecting with the mouse. If off, the user is operating `conhost.exe` mark mode selection with the keyboard. | 59 | | **CONSOLE_NO_SELECTION** 0x0000 | No selection. | 60 | | **CONSOLE_SELECTION_IN_PROGRESS** 0x0001 | Selection has begun. If a mouse selection, this will typically not occur without the `CONSOLE_SELECTION_NOT_EMPTY` flag. If a keyboard selection, this may occur when mark mode has been entered but the user is still navigating to the initial position. | 61 | | **CONSOLE_SELECTION_NOT_EMPTY** 0x0002 | Selection rectangle not empty. The payload of *dwSelectionAnchor* and *srSelection* are valid. | 62 | 63 | **dwSelectionAnchor** 64 | A [**COORD**](coord-str.md) structure that specifies the selection anchor, in characters. 65 | 66 | **srSelection** 67 | A [**SMALL\_RECT**](small-rect-str.md) structure that specifies the selection rectangle. 68 | 69 | ## Requirements 70 | 71 | |   |   | 72 | |-|-| 73 | | Minimum supported client | Windows XP \[desktop apps only\] | 74 | | Minimum supported server | Windows Server 2003 \[desktop apps only\] | 75 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 76 | 77 | ## See also 78 | 79 | [**COORD**](coord-str.md) 80 | 81 | [**GetConsoleSelectionInfo**](getconsoleselectioninfo.md) 82 | 83 | [**SMALL\_RECT**](small-rect-str.md) 84 | -------------------------------------------------------------------------------- /docs/console-selection.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Console Selection 3 | description: An accessibility application needs information about the user's selection in the console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_console\_selection' 10 | - 'base.console\_selection' 11 | - 'consoles.console\_selection' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 2f631e1b-d502-45b7-9c15-34c01e913738 16 | --- 17 | 18 | # Console Selection 19 | 20 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 21 | 22 | An accessibility application needs information about the user's selection in the console. To retrieve the current console selection, call the [**GetConsoleSelectionInfo**](getconsoleselectioninfo.md) function. The [**CONSOLE\_SELECTION\_INFO**](console-selection-info-str.md) structure contains information about the selection, such as the anchor, coordinates, and status. 23 | -------------------------------------------------------------------------------- /docs/console-structures.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Console Structures 3 | description: Describes a complete list of the structurest that are used to access a console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: reference 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_console\_structures' 10 | - 'base.console\_structures' 11 | - 'consoles.console\_structures' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 60f59616-d42b-469a-acf1-c1b71e68f560 16 | --- 17 | 18 | # Console Structures 19 | 20 | The following structures are used to access a console. 21 | 22 | - [**CHAR\_INFO**](char-info-str.md) 23 | - [**CONSOLE\_CURSOR\_INFO**](console-cursor-info-str.md) 24 | - [**CONSOLE\_FONT\_INFO**](console-font-info-str.md) 25 | - [**CONSOLE\_FONT\_INFOEX**](console-font-infoex.md) 26 | - [**CONSOLE\_HISTORY\_INFO**](console-history-info.md) 27 | - [**CONSOLE\_READCONSOLE\_CONTROL**](console-readconsole-control.md) 28 | - [**CONSOLE\_SCREEN\_BUFFER\_INFO**](console-screen-buffer-info-str.md) 29 | - [**CONSOLE\_SCREEN\_BUFFER\_INFOEX**](console-screen-buffer-infoex.md) 30 | - [**CONSOLE\_SELECTION\_INFO**](console-selection-info-str.md) 31 | - [**COORD**](coord-str.md) 32 | - [**FOCUS\_EVENT\_RECORD**](focus-event-record-str.md) 33 | - [**INPUT\_RECORD**](input-record-str.md) 34 | - [**KEY\_EVENT\_RECORD**](key-event-record-str.md) 35 | - [**MENU\_EVENT\_RECORD**](menu-event-record-str.md) 36 | - [**MOUSE\_EVENT\_RECORD**](mouse-event-record-str.md) 37 | - [**SMALL\_RECT**](small-rect-str.md) 38 | - [**WINDOW\_BUFFER\_SIZE\_RECORD**](window-buffer-size-record-str.md) 39 | -------------------------------------------------------------------------------- /docs/consoles.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Consoles – Windows Desktop 3 | description: A console is an application that provides I/O to command-line applications. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_consoles' 10 | - 'base.consoles' 11 | - 'consoles.consoles' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 16148ce6-d3be-40dd-b82e-50ea1df67c4e 16 | --- 17 | 18 | # Consoles 19 | 20 | A *console* is an application that provides I/O services to character-mode applications. 21 | 22 | A console consists of an input buffer and one or more screen buffers. The *input buffer* contains a queue of input records, each of which contains information about an input event. The input queue always includes key-press and key-release events. It may also include mouse events (pointer movements and button presses and releases) and events during which user actions affect the size of the active screen buffer. A *screen buffer* is a two-dimensional array of character and color data for output in a console window. Any number of processes can share a console. 23 | 24 | > [!TIP] 25 | >A broader idea of consoles and how they relate to terminals and command-line client applications can be found in the **[ecosystem roadmap](ecosystem-roadmap.md)**. 26 | 27 | - [Creation of a Console](creation-of-a-console.md) 28 | - [Attaching to a Console](attaching-to-a-console.md) 29 | - [Closing a Console](closing-a-console.md) 30 | - [Console Handles](console-handles.md) 31 | - [Console Input Buffer](console-input-buffer.md) 32 | - [Console Screen Buffers](console-screen-buffers.md) 33 | - [Window and Screen Buffer Size](window-and-screen-buffer-size.md) 34 | - [Console Selection](console-selection.md) 35 | - [Scrolling the Screen Buffer](scrolling-the-screen-buffer.md) 36 | -------------------------------------------------------------------------------- /docs/coord-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: COORD structure 3 | description: Defines the coordinates of a character cell in a console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - wincontypes/COORD 10 | - wincon/COORD 11 | - COORD 12 | - wincontypes/PCOORD 13 | - wincon/PCOORD 14 | - PCOORD 15 | MS-HAID: 16 | - '\_win32\_coord\_str' 17 | - 'base.coord\_str' 18 | - 'consoles.coord\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: d730c46e-ea17-475e-b956-8ee5f4f5c04e 23 | 24 | topic_type: 25 | - apiref 26 | api_name: 27 | - COORD 28 | api_location: 29 | - WinCon.h 30 | api_type: 31 | - HeaderDef 32 | --- 33 | 34 | # COORD structure 35 | 36 | Defines the coordinates of a character cell in a console screen buffer. The origin of the coordinate system (0,0) is at the top, left cell of the buffer. 37 | 38 | ## Syntax 39 | 40 | ```C 41 | typedef struct _COORD { 42 | SHORT X; 43 | SHORT Y; 44 | } COORD, *PCOORD; 45 | ``` 46 | 47 | ## Members 48 | 49 | **X** 50 | The horizontal coordinate or column value. The units depend on the function call. 51 | 52 | **Y** 53 | The vertical coordinate or row value. The units depend on the function call. 54 | 55 | ## Examples 56 | 57 | For an example, see [Scrolling a Screen Buffer's Contents](scrolling-a-screen-buffer-s-contents.md). 58 | 59 | ## Requirements 60 | 61 | |   |   | 62 | |-|-| 63 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 64 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 65 | | Header | WinConTypes.h (via WinCon.h, include Windows.h) | 66 | 67 | ## See also 68 | 69 | [**CONSOLE\_FONT\_INFO**](console-font-info-str.md) 70 | 71 | [**CONSOLE\_SCREEN\_BUFFER\_INFO**](console-screen-buffer-info-str.md) 72 | 73 | [**CONSOLE\_SELECTION\_INFO**](console-selection-info-str.md) 74 | 75 | [**FillConsoleOutputAttribute**](fillconsoleoutputattribute.md) 76 | 77 | [**FillConsoleOutputCharacter**](fillconsoleoutputcharacter.md) 78 | 79 | [**GetConsoleFontSize**](getconsolefontsize.md) 80 | 81 | [**GetLargestConsoleWindowSize**](getlargestconsolewindowsize.md) 82 | 83 | [**MOUSE\_EVENT\_RECORD**](mouse-event-record-str.md) 84 | 85 | [**ReadConsoleOutput**](readconsoleoutput.md) 86 | 87 | [**ReadConsoleOutputAttribute**](readconsoleoutputattribute.md) 88 | 89 | [**ReadConsoleOutputCharacter**](readconsoleoutputcharacter.md) 90 | 91 | [**ScrollConsoleScreenBuffer**](scrollconsolescreenbuffer.md) 92 | 93 | [**SetConsoleCursorPosition**](setconsolecursorposition.md) 94 | 95 | [**SetConsoleDisplayMode**](setconsoledisplaymode.md) 96 | 97 | [**SetConsoleScreenBufferSize**](setconsolescreenbuffersize.md) 98 | 99 | [**WINDOW\_BUFFER\_SIZE\_RECORD**](window-buffer-size-record-str.md) 100 | 101 | [**WriteConsoleOutput**](writeconsoleoutput.md) 102 | 103 | [**WriteConsoleOutputAttribute**](writeconsoleoutputattribute.md) 104 | 105 | [**WriteConsoleOutputCharacter**](writeconsoleoutputcharacter.md) 106 | -------------------------------------------------------------------------------- /docs/ctrl-c-and-ctrl-break-signals.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CTRL+C and CTRL+BREAK Signals 3 | description: The CTRL+C and CTRL+BREAK key combinations receive special handling by console processes. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_ctrl\_c\_and\_ctrl\_break\_signals' 10 | - 'base.ctrl\_c\_and\_ctrl\_break\_signals' 11 | - 'consoles.ctrl\_c\_and\_ctrl\_break\_signals' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 5357ed99-920b-47a0-a922-d5faed7bf23e 16 | --- 17 | 18 | # CTRL+C and CTRL+BREAK Signals 19 | 20 | The CTRL+C and CTRL+BREAK key combinations receive special handling by console processes. By default, when a console window has the keyboard focus, CTRL+C or CTRL+BREAK is treated as a signal (SIGINT or SIGBREAK) and not as keyboard input. By default, these signals are passed to all console processes that are attached to the console. (Detached processes are not affected. See [**Creation of a Console**](creation-of-a-console.md).) The system creates a new thread in each client process to handle the event. The thread raises an exception if the process is being debugged. The debugger can handle the exception or continue with the exception unhandled. 21 | 22 | CTRL+BREAK is always treated as a signal, but an application can change the default CTRL+C behavior in two ways that prevent the handler functions from being called: 23 | 24 | - The [**SetConsoleMode**](setconsolemode.md) function can disable the **ENABLE\_PROCESSED\_INPUT** input mode for a console's input buffer, so CTRL+C is reported as keyboard input rather than as a signal. 25 | - When [**SetConsoleCtrlHandler**](setconsolectrlhandler.md) is called with **NULL** and **TRUE** values for its parameters, the calling process ignores CTRL+C signals. Normal CTRL+C processing is restored by calling **SetConsoleCtrlHandler** with **NULL** and **FALSE** values. This attribute of ignoring or not ignoring CTRL+C signals is inherited by child processes, but it can be enabled or disabled by any process without affecting existing processes. 26 | 27 | For more information on how these signals are processed, including timeouts, please see the [**Handler Routine**](handlerroutine.md) callback documentation. 28 | -------------------------------------------------------------------------------- /docs/ctrl-close-signal.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CTRL+CLOSE Signal 3 | description: The system generates a CTRL+CLOSE signal when the user closes a console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_ctrl\_close\_signal' 10 | - 'base.ctrl\_close\_signal' 11 | - 'consoles.ctrl\_close\_signal' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: a327dd55-3250-40ee-b1c4-6ba3b80984a8 16 | --- 17 | 18 | # CTRL+CLOSE Signal 19 | 20 | The system generates a CTRL+CLOSE signal when the user closes a console. All processes attached to the console receive the signal, giving each process an opportunity to clean up before termination. When a process receives this signal, the handler function can take one of the following actions after performing any cleanup operations: 21 | 22 | - Call [**ExitProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess) to terminate the process. 23 | - Return **FALSE**. If none of the registered handler functions returns **TRUE**, the default handler terminates the process. 24 | - Return **TRUE**. In this case, no other handler functions are called and the process terminates. -------------------------------------------------------------------------------- /docs/docfx.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": { 3 | "content": [ 4 | { 5 | "files": [ 6 | "**/*.md", 7 | "breadcrumb/toc.yml" 8 | ], 9 | "exclude": [ 10 | "**/obj/**", 11 | "console/**", 12 | "**/includes/**" 13 | ] 14 | } 15 | ], 16 | "resource": [ 17 | { 18 | "files": [ 19 | "**/*.png", 20 | "**/*.jpg" 21 | ], 22 | "exclude": [ 23 | "**/obj/**", 24 | "console/**", 25 | "**/includes/**" 26 | ] 27 | } 28 | ], 29 | "overwrite": [], 30 | "externalReference": [], 31 | "globalMetadata": { 32 | "uhfHeaderId": "MSDocsHeader-Windows", 33 | "ms.subservice": "windows-console", 34 | "titleSuffix": "Windows Console", 35 | "searchScope": [ 36 | "Console" 37 | ], 38 | "ms.topic": "article", 39 | "ms.date": "07/12/2018", 40 | "ms.service": "windows", 41 | "breadcrumb_path": "/windows/console/breadcrumb/toc.json", 42 | "extendBreadcrumb": true, 43 | "feedback_system": "Standard", 44 | "feedback_product_url": "https://github.com/microsoft/terminal/issues", 45 | "feedback_help_link_url": "https://learn.microsoft.com/answers/", 46 | "feedback_help_link_type": "get-help-at-qna" 47 | }, 48 | "fileMetadata": {}, 49 | "template": [], 50 | "dest": "console", 51 | "markdownEngineName": "markdig" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /docs/flushconsoleinputbuffer.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: FlushConsoleInputBuffer function 3 | description: Flushes the console input buffer. All input records currently in the input buffer are discarded. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/FlushConsoleInputBuffer 10 | - wincon/FlushConsoleInputBuffer 11 | - FlushConsoleInputBuffer 12 | MS-HAID: 13 | - '\_win32\_flushconsoleinputbuffer' 14 | - 'base.flushconsoleinputbuffer' 15 | - 'consoles.flushconsoleinputbuffer' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 6f7832d6-1fb2-4ca8-bd07-43123c990851 20 | topic_type: 21 | - apiref 22 | api_name: 23 | - FlushConsoleInputBuffer 24 | api_location: 25 | - Kernel32.dll 26 | - API-MS-Win-Core-Console-l2-1-0.dll 27 | - KernelBase.dll 28 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 29 | api_type: 30 | - DllExport 31 | --- 32 | 33 | # FlushConsoleInputBuffer function 34 | 35 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 36 | 37 | Flushes the console input buffer. All input records currently in the input buffer are discarded. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | BOOL WINAPI FlushConsoleInputBuffer( 43 | _In_ HANDLE hConsoleInput 44 | ); 45 | ``` 46 | 47 | ## Parameters 48 | 49 | *hConsoleInput* \[in\] 50 | A handle to the console input buffer. The handle must have the **GENERIC\_WRITE** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 51 | 52 | ## Return value 53 | 54 | If the function succeeds, the return value is nonzero. 55 | 56 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 57 | 58 | ## Remarks 59 | 60 | > [!TIP] 61 | > This API is not recommended and does not have a **[virtual terminal](console-virtual-terminal-sequences.md)** equivalent. Attempting to empty the input queue all at once can destroy state in the queue in an unexpected manner. 62 | 63 | ## Requirements 64 | 65 | |   |   | 66 | |-|-| 67 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 68 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 69 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 70 | | Library | Kernel32.lib | 71 | | DLL | Kernel32.dll | 72 | 73 | ## See also 74 | 75 | [Console Functions](console-functions.md) 76 | 77 | [Low-Level Console Input Functions](low-level-console-input-functions.md) 78 | 79 | [**GetNumberOfConsoleInputEvents**](getnumberofconsoleinputevents.md) 80 | 81 | [**PeekConsoleInput**](peekconsoleinput.md) 82 | 83 | [**ReadConsoleInput**](readconsoleinput.md) 84 | 85 | [**WriteConsoleInput**](writeconsoleinput.md) -------------------------------------------------------------------------------- /docs/focus-event-record-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: FOCUS_EVENT_RECORD structure 3 | description: Describes a focus event in a console INPUT\_RECORD structure. These events are used internally and should be ignored. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - wincontypes/FOCUS_EVENT_RECORD 10 | - wincon/FOCUS_EVENT_RECORD 11 | - FOCUS_EVENT_RECORD 12 | - wincontypes/PFOCUS_EVENT_RECORD 13 | - wincon/PFOCUS_EVENT_RECORD 14 | - PFOCUS_EVENT_RECORD 15 | MS-HAID: 16 | - '\_win32\_focus\_event\_record\_str' 17 | - 'base.focus\_event\_record\_str' 18 | - 'consoles.focus\_event\_record\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: 4db0ae89-8446-4f0a-98e2-ba0b11ef7efe 23 | 24 | topic_type: 25 | - apiref 26 | api_name: 27 | - FOCUS_EVENT_RECORD 28 | api_location: 29 | - WinCon.h 30 | api_type: 31 | - HeaderDef 32 | --- 33 | 34 | # FOCUS\_EVENT\_RECORD structure 35 | 36 | Describes a focus event in a console [**INPUT\_RECORD**](input-record-str.md) structure. These events are used internally and should be ignored. 37 | 38 | ## Syntax 39 | 40 | ```C 41 | typedef struct _FOCUS_EVENT_RECORD { 42 | BOOL bSetFocus; 43 | } FOCUS_EVENT_RECORD; 44 | ``` 45 | 46 | ## Members 47 | 48 | **bSetFocus** 49 | Reserved. 50 | 51 | ## Requirements 52 | 53 | |   |   | 54 | |-|-| 55 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 56 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 57 | | Header | WinConTypes.h (via WinCon.h, include Windows.h) | 58 | 59 | ## See also 60 | 61 | [**INPUT\_RECORD**](input-record-str.md) 62 | -------------------------------------------------------------------------------- /docs/freeconsole.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: FreeConsole function 3 | description: See reference information about the FreeConsole function, which detaches the calling process from its console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi/FreeConsole 10 | - wincon/FreeConsole 11 | - FreeConsole 12 | MS-HAID: 13 | - '\_win32\_freeconsole' 14 | - 'base.freeconsole' 15 | - 'consoles.freeconsole' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 6c525325-696e-4d8b-8337-cbf9e31c900c 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - FreeConsole 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l2-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | api_type: 31 | - DllExport 32 | --- 33 | 34 | # FreeConsole function 35 | 36 | Detaches the calling process from its console. 37 | 38 | ## Syntax 39 | 40 | ```C 41 | BOOL WINAPI FreeConsole(void); 42 | ``` 43 | 44 | ## Parameters 45 | 46 | This function has no parameters. 47 | 48 | ## Return value 49 | 50 | If the function succeeds, the return value is nonzero. 51 | 52 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 53 | 54 | ## Remarks 55 | 56 | A process can be attached to at most one console. A process can use the **FreeConsole** function to detach itself from its console. If other processes share the console, the console is not destroyed, but the process that called **FreeConsole** cannot refer to it. A console is closed when the last process attached to it terminates or calls **FreeConsole**. After a process calls **FreeConsole**, it can call the [**AllocConsole**](allocconsole.md) function to create a new console or [**AttachConsole**](attachconsole.md) to attach to another console. 57 | If the calling process is not already attached to a console, the **FreeConsole** request still succeeds. 58 | 59 | ## Requirements 60 | 61 | |   |   | 62 | |-|-| 63 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 64 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 65 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 66 | | Library | Kernel32.lib | 67 | | DLL | Kernel32.dll | 68 | 69 | ## See also 70 | 71 | [**AllocConsole**](allocconsole.md) 72 | 73 | [**AttachConsole**](attachconsole.md) 74 | 75 | [Console Functions](console-functions.md) 76 | 77 | [Consoles](consoles.md) 78 | -------------------------------------------------------------------------------- /docs/getconsolealias.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleAlias function 3 | description: Retrieves the text for the specified console alias and the name of the executable. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleAlias 10 | - wincon/GetConsoleAlias 11 | - GetConsoleAlias 12 | - consoleapi3/GetConsoleAliasA 13 | - wincon/GetConsoleAliasA 14 | - GetConsoleAliasA 15 | - consoleapi3/GetConsoleAliasW 16 | - wincon/GetConsoleAliasW 17 | - GetConsoleAliasW 18 | MS-HAID: 19 | - 'base.getconsolealias' 20 | - 'consoles.getconsolealias' 21 | MSHAttr: 22 | - 'PreferredSiteName:MSDN' 23 | - 'PreferredLib:/library/windows/desktop' 24 | ms.assetid: e8514f24-8121-4fad-94bb-c9eedf7a700d 25 | 26 | topic_type: 27 | - apiref 28 | api_name: 29 | - GetConsoleAlias 30 | - GetConsoleAliasA 31 | - GetConsoleAliasW 32 | api_location: 33 | - Kernel32.dll 34 | api_type: 35 | - DllExport 36 | --- 37 | 38 | # GetConsoleAlias function 39 | 40 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 41 | 42 | Retrieves the text for the specified console alias and executable. 43 | 44 | ## Syntax 45 | 46 | ```C 47 | DWORD WINAPI GetConsoleAlias( 48 | _In_  LPTSTR lpSource, 49 | _Out_ LPTSTR lpTargetBuffer, 50 | _In_  DWORD  TargetBufferLength, 51 | _In_  LPTSTR lpExeName 52 | ); 53 | ``` 54 | 55 | ## Parameters 56 | 57 | *lpSource* \[in\] 58 | The console alias whose text is to be retrieved. 59 | 60 | *lpTargetBuffer* \[out\] 61 | A pointer to a buffer that receives the text associated with the console alias. 62 | 63 | *TargetBufferLength* \[in\] 64 | The size of the buffer pointed to by *lpTargetBuffer*, in bytes. 65 | 66 | *lpExeName* \[in\] 67 | The name of the executable file. 68 | 69 | ## Return value 70 | 71 | If the function succeeds, the return value is nonzero. 72 | 73 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 74 | 75 | ## Remarks 76 | 77 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0501 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 78 | 79 | [!INCLUDE [no-vt-equiv-shell-banner](./includes/no-vt-equiv-shell-banner.md)] 80 | 81 | ## Requirements 82 | 83 | |   |   | 84 | |-|-| 85 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 86 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 87 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 88 | | Library | Kernel32.lib | 89 | | DLL | Kernel32.dll | 90 | | Unicode and ANSI names | **GetConsoleAliasW** (Unicode) and **GetConsoleAliasA** (ANSI) | 91 | 92 | ## See also 93 | 94 | [Console Aliases](console-aliases.md) 95 | 96 | [Console Functions](console-functions.md) 97 | 98 | [**AddConsoleAlias**](addconsolealias.md) 99 | 100 | [**GetConsoleAliases**](getconsolealiases.md) 101 | 102 | [**GetConsoleAliasExes**](getconsolealiasexes.md) -------------------------------------------------------------------------------- /docs/getconsolealiases.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleAliases function 3 | description: Retrieves all of the defined console aliases for the specified executable. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleAliases 10 | - wincon/GetConsoleAliases 11 | - GetConsoleAliases 12 | - consoleapi3/GetConsoleAliasesA 13 | - wincon/GetConsoleAliasesA 14 | - GetConsoleAliasesA 15 | - consoleapi3/GetConsoleAliasesW 16 | - wincon/GetConsoleAliasesW 17 | - GetConsoleAliasesW 18 | MS-HAID: 19 | - 'base.getconsolealiases' 20 | - 'consoles.getconsolealiases' 21 | MSHAttr: 22 | - 'PreferredSiteName:MSDN' 23 | - 'PreferredLib:/library/windows/desktop' 24 | ms.assetid: 92eefa4e-ffde-4886-afde-5aecf450b425 25 | 26 | topic_type: 27 | - apiref 28 | api_name: 29 | - GetConsoleAliases 30 | - GetConsoleAliasesA 31 | - GetConsoleAliasesW 32 | api_location: 33 | - Kernel32.dll 34 | api_type: 35 | - DllExport 36 | --- 37 | 38 | # GetConsoleAliases function 39 | 40 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 41 | 42 | Retrieves all defined console aliases for the specified executable. 43 | 44 | ## Syntax 45 | 46 | ```C 47 | DWORD WINAPI GetConsoleAliases( 48 | _Out_ LPTSTR lpAliasBuffer, 49 | _In_  DWORD  AliasBufferLength, 50 | _In_  LPTSTR lpExeName 51 | ); 52 | ``` 53 | 54 | ## Parameters 55 | 56 | *lpAliasBuffer* \[out\] 57 | A pointer to a buffer that receives the aliases. 58 | 59 | The format of the data is as follows: *Source1*=*Target1*\\0*Source2*=*Target2*\\0... *SourceN*=*TargetN*\\0, where *N* is the number of console aliases defined. 60 | 61 | *AliasBufferLength* \[in\] 62 | The size of the buffer pointed to by *lpAliasBuffer*, in bytes. 63 | 64 | *lpExeName* \[in\] 65 | The executable file whose aliases are to be retrieved. 66 | 67 | ## Return value 68 | 69 | If the function succeeds, the return value is nonzero. 70 | 71 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 72 | 73 | ## Remarks 74 | 75 | To determine the required size for the *lpExeName* buffer, use the [**GetConsoleAliasesLength**](getconsolealiaseslength.md) function. 76 | 77 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0501 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 78 | 79 | [!INCLUDE [no-vt-equiv-shell-banner](./includes/no-vt-equiv-shell-banner.md)] 80 | 81 | ## Requirements 82 | 83 | |   |   | 84 | |-|-| 85 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 86 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 87 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 88 | | Library | Kernel32.lib | 89 | | DLL | Kernel32.dll | 90 | | Unicode and ANSI names | **GetConsoleAliasesW** (Unicode) and **GetConsoleAliasesA** (ANSI) | 91 | 92 | ## See also 93 | 94 | [**AddConsoleAlias**](addconsolealias.md) 95 | 96 | [Console Aliases](console-aliases.md) 97 | 98 | [Console Functions](console-functions.md) 99 | 100 | [**GetConsoleAlias**](getconsolealias.md) 101 | 102 | [**GetConsoleAliasesLength**](getconsolealiaseslength.md) 103 | 104 | [**GetConsoleAliasExes**](getconsolealiasexes.md) -------------------------------------------------------------------------------- /docs/getconsolealiaseslength.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleAliasesLength function 3 | description: Retrieves the required size for the buffer used by the GetConsoleAliases function. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleAliasesLength 10 | - wincon/GetConsoleAliasesLength 11 | - GetConsoleAliasesLength 12 | - consoleapi3/GetConsoleAliasesLengthA 13 | - wincon/GetConsoleAliasesLengthA 14 | - GetConsoleAliasesLengthA 15 | - consoleapi3/GetConsoleAliasesLengthW 16 | - wincon/GetConsoleAliasesLengthW 17 | - GetConsoleAliasesLengthW 18 | MS-HAID: 19 | - 'base.getconsolealiaseslength' 20 | - 'consoles.getconsolealiaseslength' 21 | MSHAttr: 22 | - 'PreferredSiteName:MSDN' 23 | - 'PreferredLib:/library/windows/desktop' 24 | ms.assetid: 29e49eba-0864-4ed7-af82-1ba639261c40 25 | 26 | topic_type: 27 | - apiref 28 | api_name: 29 | - GetConsoleAliasesLength 30 | - GetConsoleAliasesLengthA 31 | - GetConsoleAliasesLengthW 32 | api_location: 33 | - Kernel32.dll 34 | api_type: 35 | - DllExport 36 | --- 37 | 38 | # GetConsoleAliasesLength function 39 | 40 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 41 | 42 | Retrieves the required size for the buffer used by the [**GetConsoleAliases**](getconsolealiases.md) function. 43 | 44 | ## Syntax 45 | 46 | ```C 47 | DWORD WINAPI GetConsoleAliasesLength( 48 | _In_ LPTSTR lpExeName 49 | ); 50 | ``` 51 | 52 | ## Parameters 53 | 54 | *lpExeName* \[in\] 55 | The name of the executable file whose console aliases are to be retrieved. 56 | 57 | ## Return value 58 | 59 | The size of the buffer required to store all console aliases defined for this executable file, in bytes. 60 | 61 | ## Remarks 62 | 63 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0501 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 64 | 65 | [!INCLUDE [no-vt-equiv-shell-banner](./includes/no-vt-equiv-shell-banner.md)] 66 | 67 | ## Requirements 68 | 69 | |   |   | 70 | |-|-| 71 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 72 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 73 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 74 | | Library | Kernel32.lib | 75 | | DLL | Kernel32.dll | 76 | | Unicode and ANSI names | **GetConsoleAliasesLengthW** (Unicode) and **GetConsoleAliasesLengthA** (ANSI) | 77 | 78 | ## See also 79 | 80 | [**AddConsoleAlias**](addconsolealias.md) 81 | 82 | [Console Aliases](console-aliases.md) 83 | 84 | [Console Functions](console-functions.md) 85 | 86 | [**GetConsoleAlias**](getconsolealias.md) 87 | 88 | [**GetConsoleAliases**](getconsolealiases.md) 89 | 90 | [**GetConsoleAliasExes**](getconsolealiasexes.md) -------------------------------------------------------------------------------- /docs/getconsolealiasexes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleAliasExes function 3 | description: Retrieves the names of all executable files with console aliases defined. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleAliasExes 10 | - wincon/GetConsoleAliasExes 11 | - GetConsoleAliasExes 12 | - consoleapi3/GetConsoleAliasExesA 13 | - wincon/GetConsoleAliasExesA 14 | - GetConsoleAliasExesA 15 | - consoleapi3/GetConsoleAliasExesW 16 | - wincon/GetConsoleAliasExesW 17 | - GetConsoleAliasExesW 18 | MS-HAID: 19 | - 'base.getconsolealiasexes' 20 | - 'consoles.getconsolealiasexes' 21 | MSHAttr: 22 | - 'PreferredSiteName:MSDN' 23 | - 'PreferredLib:/library/windows/desktop' 24 | ms.assetid: c229de09-cfa6-4829-9c9a-8ff63500eaf4 25 | 26 | topic_type: 27 | - apiref 28 | api_name: 29 | - GetConsoleAliasExes 30 | - GetConsoleAliasExesA 31 | - GetConsoleAliasExesW 32 | api_location: 33 | - Kernel32.dll 34 | api_type: 35 | - DllExport 36 | --- 37 | 38 | # GetConsoleAliasExes function 39 | 40 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 41 | 42 | Retrieves the names of all executable files with console aliases defined. 43 | 44 | ## Syntax 45 | 46 | ```C 47 | DWORD WINAPI GetConsoleAliasExes( 48 | _Out_ LPTSTR lpExeNameBuffer, 49 | _In_  DWORD  ExeNameBufferLength 50 | ); 51 | ``` 52 | 53 | ## Parameters 54 | 55 | *lpExeNameBuffer* \[out\] 56 | A pointer to a buffer that receives the names of the executable files. 57 | 58 | *ExeNameBufferLength* \[in\] 59 | The size of the buffer pointed to by *lpExeNameBuffer*, in bytes. 60 | 61 | ## Return value 62 | 63 | If the function succeeds, the return value is nonzero. 64 | 65 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 66 | 67 | ## Remarks 68 | 69 | To determine the required size for the *lpExeNameBuffer* buffer, use the [**GetConsoleAliasExesLength**](getconsolealiasexeslength.md) function. 70 | 71 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0501 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 72 | 73 | [!INCLUDE [no-vt-equiv-shell-banner](./includes/no-vt-equiv-shell-banner.md)] 74 | 75 | ## Requirements 76 | 77 | |   |   | 78 | |-|-| 79 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 80 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 81 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 82 | | Library | Kernel32.lib | 83 | | DLL | Kernel32.dll | 84 | | Unicode and ANSI names | **GetConsoleAliasExesW** (Unicode) and **GetConsoleAliasExesA** (ANSI) | 85 | 86 | ## See also 87 | 88 | [**AddConsoleAlias**](addconsolealias.md) 89 | 90 | [Console Aliases](console-aliases.md) 91 | 92 | [Console Functions](console-functions.md) 93 | 94 | [**GetConsoleAlias**](getconsolealias.md) 95 | 96 | [**GetConsoleAliasExesLength**](getconsolealiasexeslength.md) 97 | 98 | [**GetConsoleAliases**](getconsolealiases.md) -------------------------------------------------------------------------------- /docs/getconsolealiasexeslength.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleAliasExesLength function 3 | description: Retrieves the required size for the buffer used by the GetConsoleAliasExes function. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapie/GetConsoleAliasExesLength 10 | - wincon/GetConsoleAliasExesLength 11 | - GetConsoleAliasExesLength 12 | - consoleapie/GetConsoleAliasExesLengthA 13 | - wincon/GetConsoleAliasExesLengthA 14 | - GetConsoleAliasExesLengthA 15 | - consoleapie/GetConsoleAliasExesLengthW 16 | - wincon/GetConsoleAliasExesLengthW 17 | - GetConsoleAliasExesLengthW 18 | MS-HAID: 19 | - 'base.getconsolealiasexeslength' 20 | - 'consoles.getconsolealiasexeslength' 21 | MSHAttr: 22 | - 'PreferredSiteName:MSDN' 23 | - 'PreferredLib:/library/windows/desktop' 24 | ms.assetid: 4f23bbb1-3e43-47a9-b91a-e91529b07fb5 25 | 26 | topic_type: 27 | - apiref 28 | api_name: 29 | - GetConsoleAliasExesLength 30 | - GetConsoleAliasExesLengthA 31 | - GetConsoleAliasExesLengthW 32 | api_location: 33 | - Kernel32.dll 34 | api_type: 35 | - DllExport 36 | --- 37 | 38 | # GetConsoleAliasExesLength function 39 | 40 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 41 | 42 | Retrieves the required size for the buffer used by the [**GetConsoleAliasExes**](getconsolealiasexes.md) function. 43 | 44 | ## Syntax 45 | 46 | ```C 47 | DWORD WINAPI GetConsoleAliasExesLength(void); 48 | ``` 49 | 50 | ## Parameters 51 | 52 | This function has no parameters. 53 | 54 | ## Return value 55 | 56 | The size of the buffer required to store the names of all executable files that have console aliases defined, in bytes. 57 | 58 | ## Remarks 59 | 60 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0501 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 61 | 62 | [!INCLUDE [no-vt-equiv-shell-banner](./includes/no-vt-equiv-shell-banner.md)] 63 | 64 | ## Requirements 65 | 66 | |   |   | 67 | |-|-| 68 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 69 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 70 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 71 | | Library | Kernel32.lib | 72 | | DLL | Kernel32.dll | 73 | | Unicode and ANSI names | **GetConsoleAliasExesLengthW** (Unicode) and **GetConsoleAliasExesLengthA** (ANSI) | 74 | 75 | ## See also 76 | 77 | [**AddConsoleAlias**](addconsolealias.md) 78 | 79 | [Console Aliases](console-aliases.md) 80 | 81 | [Console Functions](console-functions.md) 82 | 83 | [**GetConsoleAlias**](getconsolealias.md) 84 | 85 | [**GetConsoleAliases**](getconsolealiases.md) 86 | 87 | [**GetConsoleAliasExes**](getconsolealiasexes.md) -------------------------------------------------------------------------------- /docs/getconsolecp.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleCP function 3 | description: Retrieves the input code page used by the console associated with the calling process. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi/GetConsoleCP 10 | - wincon/GetConsoleCP 11 | - GetConsoleCP 12 | MS-HAID: 13 | - '\_win32\_getconsolecp' 14 | - 'base.getconsolecp' 15 | - 'consoles.getconsolecp' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 9e0af6d9-0f5c-45b3-a686-22449d26de47 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetConsoleCP 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l1-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | - MinKernelBase.dll 31 | api_type: 32 | - DllExport 33 | --- 34 | 35 | # GetConsoleCP function 36 | 37 | Retrieves the input code page used by the console associated with the calling process. A console uses its input code page to translate keyboard input into the corresponding character value. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | UINT WINAPI GetConsoleCP(void); 43 | ``` 44 | 45 | ## Parameters 46 | 47 | This function has no parameters. 48 | 49 | ## Return value 50 | 51 | The return value is a code that identifies the code page. For a list of identifiers, see [Code Page Identifiers](/windows/win32/intl/code-page-identifiers). 52 | 53 | If the return value is zero, the function has failed. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 54 | 55 | ## Remarks 56 | 57 | A code page maps 256 character codes to individual characters. Different code pages include different special characters, typically customized for a language or a group of languages. To retrieve more information about a code page, including it's name, see the [**GetCPInfoEx**](/windows/win32/api/winnls/nf-winnls-getcpinfoexa) function. 58 | 59 | To set a console's input code page, use the [**SetConsoleCP**](setconsolecp.md) function. To set and query a console's output code page, use the [**SetConsoleOutputCP**](setconsoleoutputcp.md) and [**GetConsoleOutputCP**](getconsoleoutputcp.md) functions. 60 | 61 | ## Requirements 62 | 63 | |   |   | 64 | |-|-| 65 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 66 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 67 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 68 | | Library | Kernel32.lib | 69 | | DLL | Kernel32.dll | 70 | 71 | ## See also 72 | 73 | [Console Code Pages](console-code-pages.md) 74 | 75 | [Console Functions](console-functions.md) 76 | 77 | [**GetConsoleOutputCP**](getconsoleoutputcp.md) 78 | 79 | [**SetConsoleCP**](setconsolecp.md) 80 | 81 | [**SetConsoleOutputCP**](setconsoleoutputcp.md) -------------------------------------------------------------------------------- /docs/getconsolecursorinfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleCursorInfo function 3 | description: Retrieves information about the size and visibility of the cursor for the specified console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/GetConsoleCursorInfo 10 | - wincon/GetConsoleCursorInfo 11 | - GetConsoleCursorInfo 12 | MS-HAID: 13 | - '\_win32\_getconsolecursorinfo' 14 | - 'base.getconsolecursorinfo' 15 | - 'consoles.getconsolecursorinfo' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 6200577d-8d84-46bd-9330-d0b6cbbb3e52 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetConsoleCursorInfo 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l2-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | api_type: 31 | - DllExport 32 | --- 33 | 34 | # GetConsoleCursorInfo function 35 | 36 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 37 | 38 | Retrieves information about the size and visibility of the cursor for the specified console screen buffer. 39 | 40 | ## Syntax 41 | 42 | ```C 43 | BOOL WINAPI GetConsoleCursorInfo( 44 | _In_  HANDLE               hConsoleOutput, 45 | _Out_ PCONSOLE_CURSOR_INFO lpConsoleCursorInfo 46 | ); 47 | ``` 48 | 49 | ## Parameters 50 | 51 | *hConsoleOutput* \[in\] 52 | A handle to the console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 53 | 54 | *lpConsoleCursorInfo* \[out\] 55 | A pointer to a [**CONSOLE\_CURSOR\_INFO**](console-cursor-info-str.md) structure that receives information about the console's cursor. 56 | 57 | ## Return value 58 | 59 | If the function succeeds, the return value is nonzero. 60 | 61 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 62 | 63 | ## Remarks 64 | 65 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 66 | 67 | ## Requirements 68 | 69 | |   |   | 70 | |-|-| 71 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 72 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 73 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 74 | | Library | Kernel32.lib | 75 | | DLL | Kernel32.dll | 76 | 77 | ## See also 78 | 79 | [Console Functions](console-functions.md) 80 | 81 | [Console Screen Buffers](console-screen-buffers.md) 82 | 83 | [**CONSOLE\_CURSOR\_INFO**](console-cursor-info-str.md) 84 | 85 | [**SetConsoleCursorInfo**](setconsolecursorinfo.md) -------------------------------------------------------------------------------- /docs/getconsoledisplaymode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleDisplayMode function 3 | description: See reference information about the GetConsoleDisplayMode function, which retrieves the display mode of the current console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleDisplayMode 10 | - wincon/GetConsoleDisplayMode 11 | - GetConsoleDisplayMode 12 | MS-HAID: 13 | - '\_win32\_getconsoledisplaymode' 14 | - 'base.getconsoledisplaymode' 15 | - 'consoles.getconsoledisplaymode' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: e19ff900-a671-41d3-a9c8-9e4507c47eff 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetConsoleDisplayMode 25 | api_location: 26 | - Kernel32.dll 27 | api_type: 28 | - DllExport 29 | --- 30 | 31 | # GetConsoleDisplayMode function 32 | 33 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 34 | 35 | Retrieves the display mode of the current console. 36 | 37 | ## Syntax 38 | 39 | ```C 40 | BOOL WINAPI GetConsoleDisplayMode( 41 | _Out_ LPDWORD lpModeFlags 42 | ); 43 | ``` 44 | 45 | ## Parameters 46 | 47 | *lpModeFlags* \[out\] 48 | The display mode of the console. This parameter can be one or more of the following values. 49 | 50 | | Value | Meaning | 51 | |-|-| 52 | | **CONSOLE_FULLSCREEN** 1 | Full-screen console. The console is in this mode as soon as the window is maximized. At this point, the transition to full-screen mode can still fail. | 53 | | **CONSOLE_FULLSCREEN_HARDWARE** 2 | Full-screen console communicating directly with the video hardware. This mode is set after the console is in **CONSOLE_FULLSCREEN** mode to indicate that the transition to full-screen mode has completed. | 54 | 55 | > [!NOTE] 56 | > The transition to a 100% full screen video hardware mode was removed in Windows Vista with the replatforming of the graphics stack to [WDDM](/windows-hardware/drivers/display/introduction-to-the-windows-vista-and-later-display-driver-model). On later versions of Windows, the maximum resulting state is **CONSOLE_FULLSCREEN** representing a frameless window that appears full screen but isn't in exclusive control of the hardware. 57 | 58 | ## Return value 59 | 60 | If the function succeeds, the return value is nonzero. 61 | 62 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 63 | 64 | ## Remarks 65 | 66 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0500 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 67 | 68 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 69 | 70 | ## Requirements 71 | 72 | |   |   | 73 | |-|-| 74 | | Minimum supported client | Windows XP \[desktop apps only\] | 75 | | Minimum supported server | Windows Server 2003 \[desktop apps only\] | 76 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 77 | | Library | Kernel32.lib | 78 | | DLL | Kernel32.dll | 79 | 80 | ## See also 81 | 82 | [Console Functions](console-functions.md) 83 | 84 | [Console Modes](console-modes.md) 85 | 86 | [**SetConsoleDisplayMode**](setconsoledisplaymode.md) 87 | -------------------------------------------------------------------------------- /docs/getconsolefontsize.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleFontSize function 3 | description: Retrieves the size of the font used by the specified console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleFontSize 10 | - wincon/GetConsoleFontSize 11 | - GetConsoleFontSize 12 | MS-HAID: 13 | - '\_win32\_getconsolefontsize' 14 | - 'base.getconsolefontsize' 15 | - 'consoles.getconsolefontsize' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 51b1f58d-b3fb-4e09-8398-671b3959bb01 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetConsoleFontSize 25 | api_location: 26 | - Kernel32.dll 27 | api_type: 28 | - DllExport 29 | --- 30 | 31 | # GetConsoleFontSize function 32 | 33 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 34 | 35 | Retrieves the size of the font used by the specified console screen buffer. 36 | 37 | ## Syntax 38 | 39 | ```C 40 | COORD WINAPI GetConsoleFontSize( 41 | _In_ HANDLE hConsoleOutput, 42 | _In_ DWORD  nFont 43 | ); 44 | ``` 45 | 46 | ## Parameters 47 | 48 | *hConsoleOutput* \[in\] 49 | A handle to the console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 50 | 51 | *nFont* \[in\] 52 | The index of the font whose size is to be retrieved. This index is obtained by calling the [**GetCurrentConsoleFont**](getcurrentconsolefont.md) function. 53 | 54 | ## Return value 55 | 56 | If the function succeeds, the return value is a [**COORD**](coord-str.md) structure that contains the width and height of each character in the font, in logical units. The **X** member contains the width, while the **Y** member contains the height. 57 | 58 | If the function fails, the width and the height are zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 59 | 60 | ## Remarks 61 | 62 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0500 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 63 | 64 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 65 | 66 | ## Requirements 67 | 68 | |   |   | 69 | |-|-| 70 | | Minimum supported client | Windows XP \[desktop apps only\] | 71 | | Minimum supported server | Windows Server 2003 \[desktop apps only\] | 72 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 73 | | Library | Kernel32.lib | 74 | | DLL | Kernel32.dll | 75 | 76 | ## See also 77 | 78 | [Console Functions](console-functions.md) 79 | 80 | [Console Screen Buffers](console-screen-buffers.md) 81 | 82 | [**COORD**](coord-str.md) 83 | 84 | [**GetCurrentConsoleFont**](getcurrentconsolefont.md) -------------------------------------------------------------------------------- /docs/getconsolehistoryinfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleHistoryInfo function 3 | description: See reference information about the GetConsoleHistoryInfo function, which retrieves the history settings for the console of the calling process. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleHistoryInfo 10 | - wincon/GetConsoleHistoryInfo 11 | - GetConsoleHistoryInfo 12 | MS-HAID: 13 | - 'base.getconsolehistoryinfo' 14 | - 'consoles.getconsolehistoryinfo' 15 | MSHAttr: 16 | - 'PreferredSiteName:MSDN' 17 | - 'PreferredLib:/library/windows/desktop' 18 | ms.assetid: 145008b3-8a4a-4e6a-9144-ee787ce90ef4 19 | 20 | topic_type: 21 | - apiref 22 | api_name: 23 | - GetConsoleHistoryInfo 24 | api_location: 25 | - Kernel32.dll 26 | api_type: 27 | - DllExport 28 | --- 29 | 30 | # GetConsoleHistoryInfo function 31 | 32 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 33 | 34 | Retrieves the history settings for the calling process's console. 35 | 36 | ## Syntax 37 | 38 | ```C 39 | BOOL WINAPI GetConsoleHistoryInfo( 40 | _Out_ PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo 41 | ); 42 | ``` 43 | 44 | ## Parameters 45 | 46 | *lpConsoleHistoryInfo* \[out\] 47 | A pointer to a [**CONSOLE\_HISTORY\_INFO**](console-history-info.md) structure that receives the history settings for the calling process's console. 48 | 49 | ## Return value 50 | 51 | If the function succeeds the return value is nonzero. 52 | 53 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 54 | 55 | ## Remarks 56 | 57 | If the calling process is not a console process, the function fails and sets the last error to **ERROR\_ACCESS\_DENIED**. 58 | 59 | [!INCLUDE [no-vt-equiv-shell-banner](./includes/no-vt-equiv-shell-banner.md)] 60 | 61 | ## Requirements 62 | 63 | |   |   | 64 | |-|-| 65 | | Minimum supported client | Windows Vista \[desktop apps only\] | 66 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 67 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 68 | | Library | Kernel32.lib | 69 | | DLL | Kernel32.dll | 70 | 71 | ## See also 72 | 73 | [Console Functions](console-functions.md) 74 | 75 | [**CONSOLE\_HISTORY\_INFO**](console-history-info.md) 76 | 77 | [**SetConsoleHistoryInfo**](setconsolehistoryinfo.md) -------------------------------------------------------------------------------- /docs/getconsolemode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleMode function 3 | description: Retrieves the current input mode of a console's input buffer or the current output mode of a console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi/GetConsoleMode 10 | - wincon/GetConsoleMode 11 | - GetConsoleMode 12 | MS-HAID: 13 | - '\_win32\_getconsolemode' 14 | - 'base.getconsolemode' 15 | - 'consoles.getconsolemode' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 49adf618-196d-4490-93ca-cd177807f58e 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetConsoleMode 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l1-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | - MinKernelBase.dll 31 | api_type: 32 | - DllExport 33 | --- 34 | 35 | # GetConsoleMode function 36 | 37 | Retrieves the current input mode of a console's input buffer or the current output mode of a console screen buffer. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | BOOL WINAPI GetConsoleMode( 43 | _In_  HANDLE  hConsoleHandle, 44 | _Out_ LPDWORD lpMode 45 | ); 46 | ``` 47 | 48 | ## Parameters 49 | 50 | *hConsoleHandle* \[in\] 51 | A handle to the console input buffer or the console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 52 | 53 | *lpMode* \[out\] 54 | A pointer to a variable that receives the current mode of the specified buffer. 55 | 56 | [!INCLUDE [console-mode-flags](./includes/console-mode-flags.md)] 57 | 58 | ## Return value 59 | 60 | If the function succeeds, the return value is nonzero. 61 | 62 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 63 | 64 | ## Remarks 65 | 66 | [!INCLUDE [console-mode-remarks](./includes/console-mode-remarks.md)] 67 | 68 | To change a console's I/O modes, call [**SetConsoleMode**](setconsolemode.md) function. 69 | 70 | ## Examples 71 | 72 | For an example, see [Reading Input Buffer Events](reading-input-buffer-events.md). 73 | 74 | ## Requirements 75 | 76 | |   |   | 77 | |-|-| 78 | | Minimum supported client | Windows 2000 Professional \[desktop apps \| UWP apps\] | 79 | | Minimum supported server | Windows 2000 Server \[desktop apps \| UWP apps\] | 80 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 81 | | Library | Kernel32.lib | 82 | | DLL | Kernel32.dll | 83 | 84 | ## See also 85 | 86 | [Console Functions](console-functions.md) 87 | 88 | [Console Modes](console-modes.md) 89 | 90 | [**ReadConsole**](readconsole.md) 91 | 92 | [**ReadConsoleInput**](readconsoleinput.md) 93 | 94 | [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) 95 | 96 | [**SetConsoleMode**](setconsolemode.md) 97 | 98 | [**WriteConsole**](writeconsole.md) 99 | 100 | [**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile) 101 | -------------------------------------------------------------------------------- /docs/getconsoleoriginaltitle.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleOriginalTitle function 3 | description: See reference information about the GetConsoleOriginalTitle function, which retrieves the original title for the current console window. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/GetConsoleOriginalTitle 10 | - wincon/GetConsoleOriginalTitle 11 | - GetConsoleOriginalTitle 12 | - consoleapi2/GetConsoleOriginalTitleA 13 | - wincon/GetConsoleOriginalTitleA 14 | - GetConsoleOriginalTitleA 15 | - consoleapi2/GetConsoleOriginalTitleW 16 | - wincon/GetConsoleOriginalTitleW 17 | - GetConsoleOriginalTitleW 18 | MS-HAID: 19 | - 'base.getconsoleoriginaltitle' 20 | - 'consoles.getconsoleoriginaltitle' 21 | MSHAttr: 22 | - 'PreferredSiteName:MSDN' 23 | - 'PreferredLib:/library/windows/desktop' 24 | ms.assetid: e3dd02f4-4899-4df0-a960-3b2625c15fee 25 | 26 | topic_type: 27 | - apiref 28 | api_name: 29 | - GetConsoleOriginalTitle 30 | - GetConsoleOriginalTitleA 31 | - GetConsoleOriginalTitleW 32 | api_location: 33 | - Kernel32.dll 34 | api_type: 35 | - DllExport 36 | --- 37 | 38 | # GetConsoleOriginalTitle function 39 | 40 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 41 | 42 | Retrieves the original title for the current console window. 43 | 44 | ## Syntax 45 | 46 | ```C 47 | DWORD WINAPI GetConsoleOriginalTitle( 48 | _Out_ LPTSTR lpConsoleTitle, 49 | _In_  DWORD  nSize 50 | ); 51 | ``` 52 | 53 | ## Parameters 54 | 55 | *lpConsoleTitle* \[out\] 56 | A pointer to a buffer that receives a null-terminated string containing the original title. 57 | 58 | *nSize* \[in\] 59 | The size of the *lpConsoleTitle* buffer, in characters. 60 | 61 | ## Return value 62 | 63 | If *nSize* is zero, the return value is zero. 64 | 65 | If the function succeeds, the return value is the length of the original console title, in characters. 66 | 67 | If the function fails, the return value is zero and [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror) returns the error code. 68 | 69 | ## Remarks 70 | 71 | To set the title for a console window, use the [**SetConsoleTitle**](setconsoletitle.md) function. To retrieve the current title string, use the [**GetConsoleTitle**](getconsoletitle.md) function. 72 | 73 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0600 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 74 | 75 | > [!TIP] 76 | > This API is not recommended and does not have a **[virtual terminal](console-virtual-terminal-sequences.md)** equivalent. This decision intentionally aligns the Windows platform with other operating systems. Applications remoting via cross-platform utilities and transports like SSH may not work as expected if using this API. 77 | 78 | ## Requirements 79 | 80 | |   |   | 81 | |-|-| 82 | | Minimum supported client | Windows Vista \[desktop apps only\] | 83 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 84 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 85 | | Library | Kernel32.lib | 86 | | DLL | Kernel32.dll | 87 | | Unicode and ANSI names | **GetConsoleOriginalTitleW** (Unicode) and **GetConsoleOriginalTitleA** (ANSI) | 88 | 89 | ## See also 90 | 91 | [Console Functions](console-functions.md) 92 | 93 | [**GetConsoleTitle**](getconsoletitle.md) 94 | 95 | [**SetConsoleTitle**](setconsoletitle.md) 96 | -------------------------------------------------------------------------------- /docs/getconsoleoutputcp.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleOutputCP function 3 | description: Retrieves the output code page used by the console associated with the calling process. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi/GetConsoleOutputCP 10 | - wincon/GetConsoleOutputCP 11 | - GetConsoleOutputCP 12 | MS-HAID: 13 | - '\_win32\_getconsoleoutputcp' 14 | - 'base.getconsoleoutputcp' 15 | - 'consoles.getconsoleoutputcp' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: c23706c7-ce17-4825-a494-20ca44534d45 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetConsoleOutputCP 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l1-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | - MinKernelBase.dll 31 | api_type: 32 | - DllExport 33 | --- 34 | 35 | # GetConsoleOutputCP function 36 | 37 | Retrieves the output code page used by the console associated with the calling process. A console uses its output code page to translate the character values written by the various output functions into the images displayed in the console window. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | UINT WINAPI GetConsoleOutputCP(void); 43 | ``` 44 | 45 | ## Parameters 46 | 47 | This function has no parameters. 48 | 49 | ## Return value 50 | 51 | The return value is a code that identifies the code page. For a list of identifiers, see [Code Page Identifiers](/windows/win32/intl/code-page-identifiers). 52 | 53 | If the return value is zero, the function has failed. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 54 | 55 | ## Remarks 56 | 57 | A code page maps 256 character codes to individual characters. Different code pages include different special characters, typically customized for a language or a group of languages. To retrieve more information about a code page, including it's name, see the [**GetCPInfoEx**](/windows/win32/api/winnls/nf-winnls-getcpinfoexa) function. 58 | 59 | To set a console's output code page, use the [**SetConsoleOutputCP**](setconsoleoutputcp.md) function. To set and query a console's input code page, use the [**SetConsoleCP**](setconsolecp.md) and [**GetConsoleCP**](getconsolecp.md) functions. 60 | 61 | ## Requirements 62 | 63 | |   |   | 64 | |-|-| 65 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 66 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 67 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 68 | | Library | Kernel32.lib | 69 | | DLL | Kernel32.dll | 70 | 71 | ## See also 72 | 73 | [Console Code Pages](console-code-pages.md) 74 | 75 | [Console Functions](console-functions.md) 76 | 77 | [**GetConsoleCP**](getconsolecp.md) 78 | 79 | [**SetConsoleCP**](setconsolecp.md) 80 | 81 | [**SetConsoleOutputCP**](setconsoleoutputcp.md) -------------------------------------------------------------------------------- /docs/getconsoleprocesslist.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleProcessList function 3 | description: See reference information about the GetConsoleProcessList function, which retrieves a list of the processes attached to the current console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleProcessList 10 | - wincon/GetConsoleProcessList 11 | - GetConsoleProcessList 12 | MS-HAID: 13 | - '\_win32\_getconsoleprocesslist' 14 | - 'base.getconsoleprocesslist' 15 | - 'consoles.getconsoleprocesslist' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 3d21103b-662d-4393-ae3f-773cd9e4a930 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetConsoleProcessList 25 | api_location: 26 | - Kernel32.dll 27 | api_type: 28 | - DllExport 29 | --- 30 | 31 | # GetConsoleProcessList function 32 | 33 | Retrieves a list of the processes attached to the current console. 34 | 35 | ## Syntax 36 | 37 | ```C 38 | DWORD WINAPI GetConsoleProcessList( 39 | _Out_ LPDWORD lpdwProcessList, 40 | _In_  DWORD   dwProcessCount 41 | ); 42 | ``` 43 | 44 | ## Parameters 45 | 46 | *lpdwProcessList* \[out\] 47 | A pointer to a buffer that receives an array of process identifiers upon success. This must be a valid buffer and cannot be `NULL`. The buffer must have space to receive at least 1 returned process id. 48 | 49 | *dwProcessCount* \[in\] 50 | The maximum number of process identifiers that can be stored in the *lpdwProcessList* buffer. This must be greater than 0. 51 | 52 | ## Return value 53 | 54 | If the function succeeds, the return value is less than or equal to *dwProcessCount* and represents the number of process identifiers stored in the *lpdwProcessList* buffer. 55 | 56 | If the buffer is too small to hold all the valid process identifiers, the return value is the required number of array elements. The function will have stored no identifiers in the buffer. In this situation, use the return value to allocate a buffer that is large enough to store the entire list and call the function again. 57 | 58 | If the return value is zero, the function has failed, because every console has at least one process associated with it. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 59 | 60 | If a `NULL` process list was provided or the process count was 0, the call will return 0 and `GetLastError` will return `ERROR_INVALID_PARAMETER`. Please provide a buffer of at least one element to call this function. Allocate a larger buffer and call again if the return code is larger than the length of the provided buffer. 61 | 62 | ## Remarks 63 | 64 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0501 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 65 | 66 | [!INCLUDE [no-vt-equiv-local-context](./includes/no-vt-equiv-local-context.md)] 67 | 68 | ## Requirements 69 | 70 | |   |   | 71 | |-|-| 72 | | Minimum supported client | Windows XP \[desktop apps only\] | 73 | | Minimum supported server | Windows Server 2003 \[desktop apps only\] | 74 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 75 | | Library | Kernel32.lib | 76 | | DLL | Kernel32.dll | 77 | 78 | ## See also 79 | 80 | [**AttachConsole**](attachconsole.md) 81 | 82 | [Console Functions](console-functions.md) -------------------------------------------------------------------------------- /docs/getconsolescreenbufferinfoex.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleScreenBufferInfoEx function 3 | description: Retrieves extended information about the specified console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/GetConsoleScreenBufferInfoEx 10 | - wincon/GetConsoleScreenBufferInfoEx 11 | - GetConsoleScreenBufferInfoEx 12 | MS-HAID: 13 | - 'base.getconsolescreenbufferinfoex' 14 | - 'consoles.getconsolescreenbufferinfoex' 15 | MSHAttr: 16 | - 'PreferredSiteName:MSDN' 17 | - 'PreferredLib:/library/windows/desktop' 18 | ms.assetid: 60534226-d26f-44e2-a4cc-64811882e308 19 | 20 | topic_type: 21 | - apiref 22 | api_name: 23 | - GetConsoleScreenBufferInfoEx 24 | api_location: 25 | - Kernel32.dll 26 | - API-MS-Win-Core-Console-l2-1-0.dll 27 | - KernelBase.dll 28 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 29 | api_type: 30 | - DllExport 31 | --- 32 | 33 | # GetConsoleScreenBufferInfoEx function 34 | 35 | Retrieves extended information about the specified console screen buffer. 36 | 37 | ## Syntax 38 | 39 | ```C 40 | BOOL WINAPI GetConsoleScreenBufferInfoEx( 41 | _In_  HANDLE                        hConsoleOutput, 42 | _Out_ PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx 43 | ); 44 | ``` 45 | 46 | ## Parameters 47 | 48 | *hConsoleOutput* \[in\] 49 | A handle to the console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 50 | 51 | *lpConsoleScreenBufferInfoEx* \[out\] 52 | A [**CONSOLE\_SCREEN\_BUFFER\_INFOEX**](console-screen-buffer-infoex.md) structure that receives the requested console screen buffer information. 53 | 54 | ## Return value 55 | 56 | If the function succeeds, the return value is nonzero. 57 | 58 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 59 | 60 | ## Remarks 61 | 62 | The rectangle returned in the **srWindow** member of the [**CONSOLE\_SCREEN\_BUFFER\_INFOEX**](console-screen-buffer-infoex.md) structure can be modified and then passed to the [**SetConsoleWindowInfo**](setconsolewindowinfo.md) function to scroll the console screen buffer in the window, to change the size of the window, or both. 63 | 64 | All coordinates returned in the [**CONSOLE\_SCREEN\_BUFFER\_INFOEX**](console-screen-buffer-infoex.md) structure are in character-cell coordinates, where the origin (0, 0) is at the upper-left corner of the console screen buffer. 65 | 66 | > [!TIP] 67 | > This API does not have a **[virtual terminal](console-virtual-terminal-sequences.md)** equivalent. Its use may still be required for applications that are attempting to draw columns, grids, or fill the display to retrieve the window size. This window state is managed by the TTY/PTY/Pseudoconsole outside of the normal stream flow and is generally considered a user privilege not adjustable by the client application. Updates can be received on [**ReadConsoleInput**](readconsoleinput.md). 68 | 69 | ## Requirements 70 | 71 | |   |   | 72 | |-|-| 73 | | Minimum supported client | Windows Vista \[desktop apps only\] | 74 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 75 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 76 | | Library | Kernel32.lib | 77 | | DLL | Kernel32.dll | 78 | 79 | ## See also 80 | 81 | [Console Functions](console-functions.md) 82 | 83 | [**CONSOLE\_SCREEN\_BUFFER\_INFOEX**](console-screen-buffer-infoex.md) 84 | 85 | [**SetConsoleScreenBufferInfoEx**](setconsolescreenbufferinfoex.md) -------------------------------------------------------------------------------- /docs/getconsoleselectioninfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleSelectionInfo function 3 | description: See reference information about the GetConsoleSelectionInfo function, which retrieves information about the current console selection. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleSelectionInfo 10 | - wincon/GetConsoleSelectionInfo 11 | - GetConsoleSelectionInfo 12 | MS-HAID: 13 | - '\_win32\_getconsoleselectioninfo' 14 | - 'base.getconsoleselectioninfo' 15 | - 'consoles.getconsoleselectioninfo' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 912efe9d-75dd-43bd-8dca-08671b5ed79c 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetConsoleSelectionInfo 25 | api_location: 26 | - Kernel32.dll 27 | api_type: 28 | - DllExport 29 | --- 30 | 31 | # GetConsoleSelectionInfo function 32 | 33 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 34 | 35 | Retrieves information about the current console selection. 36 | 37 | ## Syntax 38 | 39 | ```C 40 | BOOL WINAPI GetConsoleSelectionInfo( 41 | _Out_ PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo 42 | ); 43 | ``` 44 | 45 | ## Parameters 46 | 47 | *lpConsoleSelectionInfo* \[out\] 48 | A pointer to a [**CONSOLE\_SELECTION\_INFO**](console-selection-info-str.md) structure that receives the selection information. 49 | 50 | ## Return value 51 | 52 | If the function succeeds, the return value is nonzero. 53 | 54 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 55 | 56 | ## Remarks 57 | 58 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0500 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 59 | 60 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 61 | 62 | ## Requirements 63 | 64 | |   |   | 65 | |-|-| 66 | | Minimum supported client | Windows XP \[desktop apps only\] | 67 | | Minimum supported server | Windows Server 2003 \[desktop apps only\] | 68 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 69 | | Library | Kernel32.lib | 70 | | DLL | Kernel32.dll | 71 | 72 | ## See also 73 | 74 | [Console Functions](console-functions.md) 75 | 76 | [Console Selection](console-selection.md) 77 | 78 | [**CONSOLE\_SELECTION\_INFO**](console-selection-info-str.md) -------------------------------------------------------------------------------- /docs/getconsoletitle.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleTitle function 3 | description: Retrieves the title and size of the title for the current console window. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/GetConsoleTitle 10 | - wincon/GetConsoleTitle 11 | - GetConsoleTitle 12 | - consoleapi2/GetConsoleTitleA 13 | - wincon/GetConsoleTitleA 14 | - GetConsoleTitleA 15 | - consoleapi2/GetConsoleTitleW 16 | - wincon/GetConsoleTitleW 17 | - GetConsoleTitleW 18 | MS-HAID: 19 | - '\_win32\_getconsoletitle' 20 | - 'base.getconsoletitle' 21 | - 'consoles.getconsoletitle' 22 | MSHAttr: 23 | - 'PreferredSiteName:MSDN' 24 | - 'PreferredLib:/library/windows/desktop' 25 | ms.assetid: c58bba36-9813-4bdc-83bf-30d55f8d7d79 26 | 27 | topic_type: 28 | - apiref 29 | api_name: 30 | - GetConsoleTitle 31 | - GetConsoleTitleA 32 | - GetConsoleTitleW 33 | api_location: 34 | - Kernel32.dll 35 | - API-MS-Win-Core-Console-l2-1-0.dll 36 | - KernelBase.dll 37 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 38 | - API-Ms-Win-Core-Console-Ansi-L2-1-0.dll 39 | - Kernel32Legacy.dll 40 | api_type: 41 | - DllExport 42 | --- 43 | 44 | # GetConsoleTitle function 45 | 46 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 47 | 48 | Retrieves the title for the current console window. 49 | 50 | ## Syntax 51 | 52 | ```C 53 | DWORD WINAPI GetConsoleTitle( 54 | _Out_ LPTSTR lpConsoleTitle, 55 | _In_  DWORD  nSize 56 | ); 57 | ``` 58 | 59 | ## Parameters 60 | 61 | *lpConsoleTitle* \[out\] 62 | A pointer to a buffer that receives a null-terminated string containing the title. If the buffer is too small to store the title, the function stores as many characters of the title as will fit in the buffer, ending with a null terminator. 63 | 64 | *nSize* \[in\] 65 | The size of the buffer pointed to by the *lpConsoleTitle* parameter, in characters. 66 | 67 | ## Return value 68 | 69 | If the function succeeds, the return value is the length of the console window's title, in characters. 70 | 71 | If the function fails, the return value is zero and [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror) returns the error code. 72 | 73 | ## Remarks 74 | 75 | To set the title for a console window, use the [**SetConsoleTitle**](setconsoletitle.md) function. To retrieve the original title string, use the [**GetConsoleOriginalTitle**](getconsoleoriginaltitle.md) function. 76 | 77 | [!INCLUDE [setting-codepage-mode-remarks](./includes/setting-codepage-mode-remarks.md)] 78 | 79 | > [!TIP] 80 | > This API is not recommended and does not have a **[virtual terminal](console-virtual-terminal-sequences.md)** equivalent. This decision intentionally aligns the Windows platform with other operating systems. Applications remoting via cross-platform utilities and transports like SSH may not work as expected if using this API. 81 | 82 | ## Examples 83 | 84 | For an example, see [**SetConsoleTitle**](setconsoletitle.md). 85 | 86 | ## Requirements 87 | 88 | |   |   | 89 | |-|-| 90 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 91 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 92 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 93 | | Library | Kernel32.lib | 94 | | DLL | Kernel32.dll | 95 | | Unicode and ANSI names | **GetConsoleTitleW** (Unicode) and **GetConsoleTitleA** (ANSI) | 96 | 97 | ## See also 98 | 99 | [Console Functions](console-functions.md) 100 | 101 | [**GetConsoleOriginalTitle**](getconsoleoriginaltitle.md) 102 | 103 | [**SetConsoleCP**](setconsolecp.md) 104 | 105 | [**SetConsoleOutputCP**](setconsoleoutputcp.md) 106 | 107 | [**SetConsoleTitle**](setconsoletitle.md) -------------------------------------------------------------------------------- /docs/getconsolewindow.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetConsoleWindow function 3 | description: Retrieves the window handle used by the console associated with the calling process. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetConsoleWindow 10 | - wincon/GetConsoleWindow 11 | - GetConsoleWindow 12 | MS-HAID: 13 | - '\_win32\_getconsolewindow' 14 | - 'base.getconsolewindow' 15 | - 'consoles.getconsolewindow' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: a5ab0b37-45ac-4413-b6ff-73876556ad38 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetConsoleWindow 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Kernel32-Legacy-l1-1-0.dll 28 | - kernel32legacy.dll 29 | - API-MS-Win-Core-Kernel32-Legacy-l1-1-1.dll 30 | - API-MS-Win-Core-Kernel32-Legacy-l1-1-2.dll 31 | - API-MS-Win-DownLevel-Kernel32-l2-1-0.dll 32 | - API-MS-Win-Core-Kernel32-Legacy-L1-1-3.dll 33 | - API-MS-Win-Core-Kernel32-Legacy-L1-1-4.dll 34 | - API-MS-Win-Core-Kernel32-Legacy-L1-1-5.dll 35 | api_type: 36 | - DllExport 37 | --- 38 | 39 | # GetConsoleWindow function 40 | 41 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 42 | 43 | Retrieves the window handle used by the console associated with the calling process. 44 | 45 | ## Syntax 46 | 47 | ```C 48 | HWND WINAPI GetConsoleWindow(void); 49 | ``` 50 | 51 | ## Parameters 52 | 53 | This function has no parameters. 54 | 55 | ## Return value 56 | 57 | The return value is a handle to the window used by the console associated with the calling process or **NULL** if there is no such associated console. 58 | 59 | ## Remarks 60 | 61 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0500 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 62 | 63 | 64 | [!INCLUDE [no-vt-equiv-local-context](./includes/no-vt-equiv-local-context.md)] 65 | 66 | For an application that is hosted inside a [**pseudoconsole**](pseudoconsoles.md) session, this function returns a window handle for message queue purposes only. The associated window is not displayed locally as the _pseudoconsole_ is serializing all actions to a stream for presentation on another terminal window elsewhere. 67 | 68 | ## Requirements 69 | 70 | |   |   | 71 | |-|-| 72 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 73 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 74 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 75 | | Library | Kernel32.lib | 76 | | DLL | Kernel32.dll | 77 | 78 | 79 | 80 | ## See also 81 | 82 | [Console Functions](console-functions.md) -------------------------------------------------------------------------------- /docs/getcurrentconsolefont.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetCurrentConsoleFont function 3 | description: Retrieves information about the current console font for a specified console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetCurrentConsoleFont 10 | - wincon/GetCurrentConsoleFont 11 | - GetCurrentConsoleFont 12 | MS-HAID: 13 | - '\_win32\_getcurrentconsolefont' 14 | - 'base.getcurrentconsolefont' 15 | - 'consoles.getcurrentconsolefont' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 347508ea-5c15-4568-b99f-1e7f5cdac8c1 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetCurrentConsoleFont 25 | api_location: 26 | - Kernel32.dll 27 | api_type: 28 | - DllExport 29 | --- 30 | 31 | # GetCurrentConsoleFont function 32 | 33 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 34 | 35 | Retrieves information about the current console font. 36 | 37 | ## Syntax 38 | 39 | ```C 40 | BOOL WINAPI GetCurrentConsoleFont( 41 | _In_  HANDLE             hConsoleOutput, 42 | _In_  BOOL               bMaximumWindow, 43 | _Out_ PCONSOLE_FONT_INFO lpConsoleCurrentFont 44 | ); 45 | ``` 46 | 47 | ## Parameters 48 | 49 | *hConsoleOutput* \[in\] 50 | A handle to the console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 51 | 52 | *bMaximumWindow* \[in\] 53 | If this parameter is **TRUE**, font information is retrieved for the maximum window size. If this parameter is **FALSE**, font information is retrieved for the current window size. 54 | 55 | *lpConsoleCurrentFont* \[out\] 56 | A pointer to a [**CONSOLE\_FONT\_INFO**](console-font-info-str.md) structure that receives the requested font information. 57 | 58 | ## Return value 59 | 60 | If the function succeeds, the return value is nonzero. 61 | 62 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 63 | 64 | ## Remarks 65 | 66 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0500 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 67 | 68 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 69 | 70 | ## Requirements 71 | 72 | |   |   | 73 | |-|-| 74 | | Minimum supported client | Windows XP \[desktop apps only\] | 75 | | Minimum supported server | Windows Server 2003 \[desktop apps only\] | 76 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 77 | | Library | Kernel32.lib | 78 | | DLL | Kernel32.dll | 79 | 80 | ## See also 81 | 82 | [Console Functions](console-functions.md) 83 | 84 | [Console Screen Buffers](console-screen-buffers.md) 85 | 86 | [**CONSOLE\_FONT\_INFO**](console-font-info-str.md) 87 | 88 | [**GetConsoleFontSize**](getconsolefontsize.md) -------------------------------------------------------------------------------- /docs/getcurrentconsolefontex.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetCurrentConsoleFontEx function 3 | description: See reference information about the GetCurrentConsoleFontEx function, which retrieves extended information about the currently used console font. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetCurrentConsoleFontEx 10 | - wincon/GetCurrentConsoleFontEx 11 | - GetCurrentConsoleFontEx 12 | MS-HAID: 13 | - 'base.getcurrentconsolefontex' 14 | - 'consoles.getcurrentconsolefontex' 15 | MSHAttr: 16 | - 'PreferredSiteName:MSDN' 17 | - 'PreferredLib:/library/windows/desktop' 18 | ms.assetid: 97d8e730-4110-4be5-b099-0acc1b6f8eb5 19 | 20 | topic_type: 21 | - apiref 22 | api_name: 23 | - GetCurrentConsoleFontEx 24 | api_location: 25 | - Kernel32.dll 26 | api_type: 27 | - DllExport 28 | --- 29 | 30 | # GetCurrentConsoleFontEx function 31 | 32 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 33 | 34 | Retrieves extended information about the current console font. 35 | 36 | ## Syntax 37 | 38 | ```C 39 | BOOL WINAPI GetCurrentConsoleFontEx( 40 | _In_  HANDLE               hConsoleOutput, 41 | _In_  BOOL                 bMaximumWindow, 42 | _Out_ PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx 43 | ); 44 | ``` 45 | 46 | ## Parameters 47 | 48 | *hConsoleOutput* \[in\] 49 | A handle to the console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 50 | 51 | *bMaximumWindow* \[in\] 52 | If this parameter is **TRUE**, font information is retrieved for the maximum window size. If this parameter is **FALSE**, font information is retrieved for the current window size. 53 | 54 | *lpConsoleCurrentFontEx* \[out\] 55 | A pointer to a [**CONSOLE\_FONT\_INFOEX**](console-font-infoex.md) structure that receives the requested font information. 56 | 57 | ## Return value 58 | 59 | If the function succeeds, the return value is nonzero. 60 | 61 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 62 | 63 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 64 | 65 | ## Requirements 66 | 67 | |   |   | 68 | |-|-| 69 | | Minimum supported client | Windows Vista \[desktop apps only\] | 70 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 71 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 72 | | Library | Kernel32.lib | 73 | | DLL | Kernel32.dll | 74 | 75 | ## See also 76 | 77 | [Console Functions](console-functions.md) 78 | 79 | [**CONSOLE\_FONT\_INFOEX**](console-font-infoex.md) -------------------------------------------------------------------------------- /docs/getlargestconsolewindowsize.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetLargestConsoleWindowSize function 3 | description: Retrieves the size of the largest possible console window, based on the current font and the size of the display. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/GetLargestConsoleWindowSize 10 | - wincon/GetLargestConsoleWindowSize 11 | - GetLargestConsoleWindowSize 12 | MS-HAID: 13 | - '\_win32\_getlargestconsolewindowsize' 14 | - 'base.getlargestconsolewindowsize' 15 | - 'consoles.getlargestconsolewindowsize' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 3e5897f3-4987-4a82-ab19-06c0b231ba67 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetLargestConsoleWindowSize 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l2-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | api_type: 31 | - DllExport 32 | --- 33 | 34 | # GetLargestConsoleWindowSize function 35 | 36 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 37 | 38 | Retrieves the size of the largest possible console window, based on the current font and the size of the display. 39 | 40 | ## Syntax 41 | 42 | ```C 43 | COORD WINAPI GetLargestConsoleWindowSize( 44 | _In_ HANDLE hConsoleOutput 45 | ); 46 | ``` 47 | 48 | ## Parameters 49 | 50 | *hConsoleOutput* \[in\] 51 | A handle to the console screen buffer. 52 | 53 | ## Return value 54 | 55 | If the function succeeds, the return value is a [**COORD**](coord-str.md) structure that specifies the number of character cell columns (**X** member) and rows (**Y** member) in the largest possible console window. Otherwise, the members of the structure are zero. 56 | 57 | To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 58 | 59 | ## Remarks 60 | 61 | The function does not take into consideration the size of the console screen buffer, which means that the window size returned may be larger than the size of the console screen buffer. The [**GetConsoleScreenBufferInfo**](getconsolescreenbufferinfo.md) function can be used to determine the maximum size of the console window, given the current screen buffer size, the current font, and the display size. 62 | 63 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 64 | 65 | ## Requirements 66 | 67 | |   |   | 68 | |-|-| 69 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 70 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 71 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 72 | | Library | Kernel32.lib | 73 | | DLL | Kernel32.dll | 74 | 75 | ## See also 76 | 77 | [Console Functions](console-functions.md) 78 | 79 | [**COORD**](coord-str.md) 80 | 81 | [**GetConsoleScreenBufferInfo**](getconsolescreenbufferinfo.md) 82 | 83 | [**SetConsoleWindowInfo**](setconsolewindowinfo.md) 84 | 85 | [Window and Screen Buffer Size](window-and-screen-buffer-size.md) -------------------------------------------------------------------------------- /docs/getnumberofconsoleinputevents.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetNumberOfConsoleInputEvents function 3 | description: Retrieves the number of unread input records in the console's input buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi/GetNumberOfConsoleInputEvents 10 | - wincon/GetNumberOfConsoleInputEvents 11 | - GetNumberOfConsoleInputEvents 12 | MS-HAID: 13 | - '\_win32\_getnumberofconsoleinputevents' 14 | - 'base.getnumberofconsoleinputevents' 15 | - 'consoles.getnumberofconsoleinputevents' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 1083b4f1-8fa6-4054-a516-3b447c3b0130 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetNumberOfConsoleInputEvents 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l1-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | - MinKernelBase.dll 31 | api_type: 32 | - DllExport 33 | --- 34 | 35 | # GetNumberOfConsoleInputEvents function 36 | 37 | Retrieves the number of unread input records in the console's input buffer. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | BOOL WINAPI GetNumberOfConsoleInputEvents( 43 | _In_  HANDLE  hConsoleInput, 44 | _Out_ LPDWORD lpcNumberOfEvents 45 | ); 46 | ``` 47 | 48 | ## Parameters 49 | 50 | *hConsoleInput* \[in\] 51 | A handle to the console input buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 52 | 53 | *lpcNumberOfEvents* \[out\] 54 | A pointer to a variable that receives the number of unread input records in the console's input buffer. 55 | 56 | ## Return value 57 | 58 | If the function succeeds, the return value is nonzero. 59 | 60 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 61 | 62 | ## Remarks 63 | 64 | The **GetNumberOfConsoleInputEvents** function reports the total number of unread input records in the input buffer, including keyboard, mouse, and window-resizing input records. Processes using the [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) or [**ReadConsole**](readconsole.md) function can only read keyboard input. Processes using the [**ReadConsoleInput**](readconsoleinput.md) function can read all types of input records. 65 | 66 | A process can specify a console input buffer handle in one of the [wait functions](/windows/win32/sync/wait-functions) to determine when there is unread console input. When the input buffer is not empty, the state of a console input buffer handle is signaled. 67 | 68 | To read input records from a console input buffer without affecting the number of unread records, use the [**PeekConsoleInput**](peekconsoleinput.md) function. To discard all unread records in a console's input buffer, use the [**FlushConsoleInputBuffer**](flushconsoleinputbuffer.md) function. 69 | 70 | ## Requirements 71 | 72 | |   |   | 73 | |-|-| 74 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 75 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 76 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 77 | | Library | Kernel32.lib | 78 | | DLL | Kernel32.dll | 79 | 80 | ## See also 81 | 82 | [Console Functions](console-functions.md) 83 | 84 | [**FlushConsoleInputBuffer**](flushconsoleinputbuffer.md) 85 | 86 | [Low-Level Console Input Functions](low-level-console-input-functions.md) 87 | 88 | [**PeekConsoleInput**](peekconsoleinput.md) 89 | 90 | [**ReadConsole**](readconsole.md) 91 | 92 | [**ReadConsoleInput**](readconsoleinput.md) 93 | 94 | [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) -------------------------------------------------------------------------------- /docs/getnumberofconsolemousebuttons.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GetNumberOfConsoleMouseButtons function 3 | description: Retrieves the number of buttons on the mouse used by the current console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/GetNumberOfConsoleMouseButtons 10 | - wincon/GetNumberOfConsoleMouseButtons 11 | - GetNumberOfConsoleMouseButtons 12 | MS-HAID: 13 | - '\_win32\_getnumberofconsolemousebuttons' 14 | - 'base.getnumberofconsolemousebuttons' 15 | - 'consoles.getnumberofconsolemousebuttons' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 78a6a3be-b42f-4a7a-a612-b6a2019cfec2 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - GetNumberOfConsoleMouseButtons 25 | api_location: 26 | - Kernel32.dll 27 | api_type: 28 | - DllExport 29 | --- 30 | 31 | # GetNumberOfConsoleMouseButtons function 32 | 33 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 34 | 35 | Retrieves the number of buttons on the mouse used by the current console. 36 | 37 | ## Syntax 38 | 39 | ```C 40 | BOOL WINAPI GetNumberOfConsoleMouseButtons( 41 | _Out_ LPDWORD lpNumberOfMouseButtons 42 | ); 43 | ``` 44 | 45 | ## Parameters 46 | 47 | *lpNumberOfMouseButtons* \[out\] 48 | A pointer to a variable that receives the number of mouse buttons. 49 | 50 | ## Return value 51 | 52 | If the function succeeds, the return value is nonzero. 53 | 54 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 55 | 56 | ## Remarks 57 | 58 | When a console receives mouse input, an [**INPUT\_RECORD**](input-record-str.md) structure containing a [**MOUSE\_EVENT\_RECORD**](mouse-event-record-str.md) structure is placed in the console's input buffer. The **dwButtonState** member of **MOUSE\_EVENT\_RECORD** has a bit indicating the state of each mouse button. The bit is 1 if the button is down and 0 if the button is up. To determine the number of bits that are significant, use **GetNumberOfConsoleMouseButtons**. 59 | 60 | > [!TIP] 61 | > This API is not recommended and does not have a **[virtual terminal](console-virtual-terminal-sequences.md)** equivalent. This decision intentionally aligns the Windows platform with other operating systems. This state is only relevant to the local user, session, and privilege context. Applications remoting via cross-platform utilities and transports like SSH may not work as expected if using this API. 62 | 63 | ## Requirements 64 | 65 | |   |   | 66 | |-|-| 67 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 68 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 69 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 70 | | Library | Kernel32.lib | 71 | | DLL | Kernel32.dll | 72 | 73 | ## See also 74 | 75 | [Console Functions](console-functions.md) 76 | 77 | [Console Input Buffer](console-input-buffer.md) 78 | 79 | [**ReadConsoleInput**](readconsoleinput.md) 80 | 81 | [**INPUT\_RECORD**](input-record-str.md) 82 | 83 | [**MOUSE\_EVENT\_RECORD**](mouse-event-record-str.md) -------------------------------------------------------------------------------- /docs/high-level-console-i-o.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: High-Level Console I/O 3 | description: The high-level I/O functions provide a simple way to read a stream of characters from console input or to write a stream of characters to console output. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_high\_level\_console\_i\_o' 10 | - 'base.high\_level\_console\_i\_o' 11 | - 'consoles.high\_level\_console\_i\_o' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 6d191fee-87bb-4659-8056-910149e591f7 16 | --- 17 | 18 | # High-Level Console I/O 19 | 20 | The high-level I/O functions provide a simple way to read a stream of characters from console input or to write a stream of characters to console output. A high-level read operation gets input characters from a console's input buffer and stores them in a specified buffer. A high-level write operation takes characters from a specified buffer and writes them to a screen buffer at the current cursor location, advancing the cursor as each character is written. 21 | 22 | High-level I/O gives you a choice between the [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) and [**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile) functions and the [**ReadConsole**](readconsole.md) and [**WriteConsole**](writeconsole.md) functions. They are identical, except for two important differences. The console functions support the use of either Unicode characters or the ANSI character set through the A and W variants of each function; the file I/O functions do not support Unicode except for UTF-8 set with the `CP_UTF8` constant on the **[SetConsoleCP](setconsolecp.md)** and **[SetConsoleOutputCP](setconsoleoutputcp.md)** functions prior to use. Also, the file I/O functions can be used to access files, pipes, and serial communications devices; the console functions can only be used with console handles. This distinction is important if an application relies on standard handles that may have been redirected. 23 | 24 | When using either set of high-level functions, an application can control the text and background colors used to display characters subsequently written to a screen buffer with the preferred mechanism being via **[virtual terminal sequences](console-virtual-terminal-sequences.md)**. An application can also use the console modes that affect high-level console I/O to enable or disable the following properties: 25 | 26 | - Echoing of keyboard input to the active screen buffer 27 | - Line input, in which a read operation does not return until the ENTER key is pressed 28 | - Automatic processing of keyboard input to handle carriage returns, CTRL+C, and other input details 29 | - Automatic processing of output to handle line wrapping, carriage returns, backspaces, and other output details 30 | 31 | For more information, see the following topics: 32 | 33 | - [Console Modes](console-modes.md) 34 | - [High-Level Console Modes](high-level-console-modes.md) 35 | - [High-Level Console Input and Output Functions](high-level-console-input-and-output-functions.md) 36 | - [Classic APIs Versus Virtual Terminal Sequences](classic-vs-vt.md) -------------------------------------------------------------------------------- /docs/high-level-console-modes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: High-Level Console Modes 3 | description: The behavior of the high-level console functions is affected by the console input and output modes. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_high\_level\_console\_modes' 10 | - 'base.high\_level\_console\_modes' 11 | - 'consoles.high\_level\_console\_modes' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 3ec915eb-333d-484d-a14d-46377b503ecc 16 | --- 17 | 18 | # High-Level Console Modes 19 | 20 | The behavior of the high-level console functions is affected by the console input and output modes. All of the following console input modes are enabled for a console's input buffer when a console is created: 21 | 22 | - Line input mode 23 | - Processed input mode 24 | - Echo input mode 25 | 26 | Both of the following console output modes are enabled for a console screen buffer when it is created: 27 | 28 | - Processed output mode 29 | - Wrapping at EOL output mode 30 | 31 | All three input modes, along with processed output mode, are designed to work together. It is best to either enable or disable all of these modes as a group. When all are enabled, the application is said to be in "cooked" mode, which means that most of the processing is handled for the application. When all are disabled, the application is in "raw" mode, which means that input is unfiltered and any processing is left to the application. 32 | 33 | An application can use the [**GetConsoleMode**](getconsolemode.md) function to determine the current mode of a console's input buffer or screen buffer. You can enable or disable any of these modes by using the following values in the [**SetConsoleMode**](setconsolemode.md) function. Note that setting the output mode of one screen buffer does not affect the output mode of other screen buffers. 34 | 35 | [!INCLUDE [console-mode-flags](./includes/console-mode-flags.md)] 36 | -------------------------------------------------------------------------------- /docs/images/command-line-communication.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicrosoftDocs/Console-Docs/2d4f2df928d45f6980b12feced5332fe1114a183/docs/images/command-line-communication.png -------------------------------------------------------------------------------- /docs/images/cscon-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicrosoftDocs/Console-Docs/2d4f2df928d45f6980b12feced5332fe1114a183/docs/images/cscon-01.png -------------------------------------------------------------------------------- /docs/images/cscon-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicrosoftDocs/Console-Docs/2d4f2df928d45f6980b12feced5332fe1114a183/docs/images/cscon-02.png -------------------------------------------------------------------------------- /docs/images/cscon-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicrosoftDocs/Console-Docs/2d4f2df928d45f6980b12feced5332fe1114a183/docs/images/cscon-03.png -------------------------------------------------------------------------------- /docs/images/sgr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicrosoftDocs/Console-Docs/2d4f2df928d45f6980b12feced5332fe1114a183/docs/images/sgr.png -------------------------------------------------------------------------------- /docs/includes/console-mode-remarks.md: -------------------------------------------------------------------------------- 1 | A console consists of an input buffer and one or more screen buffers. The mode of a console buffer determines how the console behaves during input or output (I/O) operations. One set of flag constants is used with input handles, and another set is used with screen buffer (output) handles. Setting the output modes of one screen buffer does not affect the output modes of other screen buffers. 2 | 3 | The **ENABLE\_LINE\_INPUT** and **ENABLE\_ECHO\_INPUT** modes only affect processes that use [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) or [**ReadConsole**](../readconsole.md) to read from the console's input buffer. Similarly, the **ENABLE\_PROCESSED\_INPUT** mode primarily affects **ReadFile** and **ReadConsole** users, except that it also determines whether CTRL+C input is reported in the input buffer (to be read by the [**ReadConsoleInput**](../readconsoleinput.md) function) or is passed to a function defined by the application. 4 | 5 | The **ENABLE\_WINDOW\_INPUT** and **ENABLE\_MOUSE\_INPUT** modes determine whether user interactions involving window resizing and mouse actions are reported in the input buffer or discarded. These events can be read by [**ReadConsoleInput**](../readconsoleinput.md), but they are always filtered by [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) and [**ReadConsole**](../readconsole.md). 6 | 7 | The **ENABLE\_PROCESSED\_OUTPUT** and **ENABLE\_WRAP\_AT\_EOL\_OUTPUT** modes only affect processes using [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) or [**ReadConsole**](../readconsole.md) and [**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile) or [**WriteConsole**](../writeconsole.md). -------------------------------------------------------------------------------- /docs/includes/no-vt-equiv-alt-buf.md: -------------------------------------------------------------------------------- 1 | > [!TIP] 2 | > This API is not recommended but it does have an approximate **[virtual terminal](../console-virtual-terminal-sequences.md)** equivalent in the **[alternate screen buffer](../console-virtual-terminal-sequences.md#alternate-screen-buffer)** sequence. Setting the _alternate screen buffer_ can provide an application with a separate, isolated space for drawing over the course of its session runtime while preserving the content that was displayed by the application's invoker. This maintains that drawing information for simple restoration on process exit. 3 | -------------------------------------------------------------------------------- /docs/includes/no-vt-equiv-banner.md: -------------------------------------------------------------------------------- 1 | > [!TIP] 2 | > This API is not recommended and does not have a **[virtual terminal](../console-virtual-terminal-sequences.md)** equivalent. This decision intentionally aligns the Windows platform with other operating systems where the individual client application is expected to remember its own drawn state for further manipulation. Applications remoting via cross-platform utilities and transports like SSH may not work as expected if using this API. 3 | -------------------------------------------------------------------------------- /docs/includes/no-vt-equiv-local-context.md: -------------------------------------------------------------------------------- 1 | > [!TIP] 2 | > This API is not recommended and does not have a **[virtual terminal](../console-virtual-terminal-sequences.md)** equivalent. This decision intentionally aligns the Windows platform with other operating systems. This state is only relevant to the local user, session, and privilege context. Applications remoting via cross-platform utilities and transports like SSH may not work as expected if using this API. 3 | -------------------------------------------------------------------------------- /docs/includes/no-vt-equiv-shell-banner.md: -------------------------------------------------------------------------------- 1 | > [!TIP] 2 | > This API is not recommended and does not have a **[virtual terminal](../console-virtual-terminal-sequences.md)** equivalent. This decision intentionally aligns the Windows platform with other operating systems where the individual client application acting as a shell or interpreter is expected to maintain its own user-convenience functionality like line reading and manipulation behavior including aliases and command history. Applications remoting via cross-platform utilities and transports like SSH may not work as expected if using this API. 3 | -------------------------------------------------------------------------------- /docs/includes/no-vt-equiv-user-priv.md: -------------------------------------------------------------------------------- 1 | > [!TIP] 2 | > This API is not recommended and does not have a **[virtual terminal](../console-virtual-terminal-sequences.md)** equivalent. This decision intentionally aligns the Windows platform with other operating systems where the user is granted full control over this presentation option. Applications remoting via cross-platform utilities and transports like SSH may not work as expected if using this API. 3 | -------------------------------------------------------------------------------- /docs/includes/not-recommended-banner.md: -------------------------------------------------------------------------------- 1 | > [!IMPORTANT] 2 | > This document describes console platform functionality that is no longer a part of our **[ecosystem roadmap](../ecosystem-roadmap.md)**. We do not recommend using this content in new products, but we will continue to support existing usages for the indefinite future. Our preferred modern solution focuses on **[virtual terminal sequences](../console-virtual-terminal-sequences.md)** for maximum compatibility in cross-platform scenarios. You can find more information about this design decision in our **[classic console vs. virtual terminal](../classic-vs-vt.md)** document. -------------------------------------------------------------------------------- /docs/includes/setting-codepage-mode-remarks.md: -------------------------------------------------------------------------------- 1 | This function uses either Unicode characters or 8-bit characters from the console's current code page. The console's code page defaults initially to the system's OEM code page. To change the console's code page, use the [**SetConsoleCP**](../setconsolecp.md) or [**SetConsoleOutputCP**](../setconsoleoutputcp.md) functions. Legacy consumers may also use the **chcp** or **mode con cp select=** commands, but it is not recommended for new development. -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Console documentation 3 | description: Read the home page for Windows Console documentation, which describes how you can programmatically control and interact with the Windows Console. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: landing-page 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | --- 9 | 10 | # Welcome to the Windows Console documentation! 11 | 12 | In the sections on the left of this page, you'll find information about the concepts, APIs and related functions, structures, etc. through which you can programmatically control and interact with the Windows Console. 13 | -------------------------------------------------------------------------------- /docs/input-record-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: INPUT_RECORD structure 3 | description: See reference information about the INPUT_RECORD structure, which describes an input event in the console input buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - wincontypes/INPUT_RECORD 10 | - wincon/INPUT_RECORD 11 | - INPUT_RECORD 12 | - wincontypes/PINPUT_RECORD 13 | - wincon/PINPUT_RECORD 14 | - PINPUT_RECORD 15 | MS-HAID: 16 | - '\_win32\_input\_record\_str' 17 | - 'base.input\_record\_str' 18 | - 'consoles.input\_record\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: a46ba7fd-097a-455d-96ac-13aa01e11dc1 23 | 24 | topic_type: 25 | - apiref 26 | api_name: 27 | - INPUT_RECORD 28 | api_location: 29 | - WinCon.h 30 | api_type: 31 | - HeaderDef 32 | --- 33 | 34 | # INPUT\_RECORD structure 35 | 36 | Describes an input event in the console input buffer. These records can be read from the input buffer by using the [**ReadConsoleInput**](readconsoleinput.md) or [**PeekConsoleInput**](peekconsoleinput.md) function, or written to the input buffer by using the [**WriteConsoleInput**](writeconsoleinput.md) function. 37 | 38 | ## Syntax 39 | 40 | ```C 41 | typedef struct _INPUT_RECORD { 42 | WORD  EventType; 43 | union { 44 | KEY_EVENT_RECORD          KeyEvent; 45 | MOUSE_EVENT_RECORD        MouseEvent; 46 | WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent; 47 | MENU_EVENT_RECORD         MenuEvent; 48 | FOCUS_EVENT_RECORD        FocusEvent; 49 | } Event; 50 | } INPUT_RECORD; 51 | ``` 52 | 53 | ## Members 54 | 55 | **EventType** 56 | A handle to the type of input event and the event record stored in the **Event** member. 57 | 58 | This member can be one of the following values. 59 | 60 | | Value | Meaning | 61 | |-|-| 62 | | **FOCUS_EVENT** 0x0010 | The **Event** member contains a **[FOCUS_EVENT_RECORD](focus-event-record-str.md)** structure. These events are used internally and should be ignored. | 63 | | **KEY_EVENT** 0x0001 | The **Event** member contains a **[KEY_EVENT_RECORD](key-event-record-str.md)** structure with information about a keyboard event. | 64 | | **MENU_EVENT** 0x0008 | The **Event** member contains a **[MENU_EVENT_RECORD](menu-event-record-str.md)** structure. These events are used internally and should be ignored. | 65 | | **MOUSE_EVENT** 0x0002 | The **Event** member contains a **[MOUSE_EVENT_RECORD](mouse-event-record-str.md)** structure with information about a mouse movement or button press event. | 66 | | **WINDOW_BUFFER_SIZE_EVENT** 0x0004 | The **Event** member contains a **[WINDOW_BUFFER_SIZE_RECORD](window-buffer-size-record-str.md)** structure with information about the new size of the console screen buffer. | 67 | 68 | **Event** 69 | The event information. The format of this member depends on the event type specified by the **EventType** member. 70 | 71 | ## Examples 72 | 73 | For an example, see [Reading Input Buffer Events](reading-input-buffer-events.md). 74 | 75 | ## Requirements 76 | 77 | |   |   | 78 | |-|-| 79 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 80 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 81 | | Header | WinConTypes.h (via WinCon.h, include Windows.h) | 82 | 83 | ## See also 84 | 85 | [**FOCUS\_EVENT\_RECORD**](focus-event-record-str.md) 86 | 87 | [**KEY\_EVENT\_RECORD**](key-event-record-str.md) 88 | 89 | [**MENU\_EVENT\_RECORD**](menu-event-record-str.md) 90 | 91 | [**MOUSE\_EVENT\_RECORD**](mouse-event-record-str.md) 92 | 93 | [**PeekConsoleInput**](peekconsoleinput.md) 94 | 95 | [**ReadConsoleInput**](readconsoleinput.md) 96 | 97 | [**WriteConsoleInput**](writeconsoleinput.md) 98 | -------------------------------------------------------------------------------- /docs/low-level-console-i-o.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Low-Level Console I/O 3 | description: The low-level console I/O functions expand an application's control over console I/O by enabling direct access to a console's input and screen buffers. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_low\_level\_console\_i\_o' 10 | - 'base.low\_level\_console\_i\_o' 11 | - 'consoles.low\_level\_console\_i\_o' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: c874aff4-6129-4dbc-8949-24d46382d81c 16 | --- 17 | 18 | # Low-Level Console I/O 19 | 20 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 21 | 22 | The low-level console I/O functions expand an application's control over console I/O by enabling direct access to a console's input and screen buffers. These functions enable an application to perform the following tasks: 23 | 24 | - Receive input about mouse and buffer-resizing events 25 | - Receive extended information about keyboard input events 26 | - Write input records to the input buffer 27 | - Read input records without removing them from the input buffer 28 | - Determine the number of pending events in the input buffer 29 | - Flush the input buffer 30 | - Read and write strings of Unicode or ANSI characters at a specified location in a screen buffer 31 | - Read and write strings of text and background color attributes at a specified screen buffer location 32 | - Read and write rectangular blocks of character and color data at a specified screen buffer location 33 | - Write a single Unicode or ANSI character, or a text and background color attribute combination, to a specified number of consecutive cells beginning at a specified screen buffer location 34 | 35 | For more information, see the following topics: 36 | 37 | - [Console Modes](console-modes.md) 38 | - [Low-Level Console Modes](low-level-console-modes.md) 39 | - [Low-Level Console Input Functions](low-level-console-input-functions.md) 40 | - [Low-Level Console Output Functions](low-level-console-output-functions.md) 41 | -------------------------------------------------------------------------------- /docs/low-level-console-modes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Low-Level Console Modes 3 | description: The types of input events reported in a console's input buffer depend on the console's mouse and window input modes. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_low\_level\_console\_modes' 10 | - 'base.low\_level\_console\_modes' 11 | - 'consoles.low\_level\_console\_modes' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 41bfdc51-27cb-4d5e-898c-507ffc8789b9 16 | --- 17 | 18 | # Low-Level Console Modes 19 | 20 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 21 | 22 | The types of input events reported in a console's input buffer depend on the console's mouse and window input modes. The console's processed input mode determines how the system handles the CTRL+C key combination. To set or retrieve the state of a console's input modes, an application can specify a console input buffer handle in a call to the [**SetConsoleMode**](setconsolemode.md) or [**GetConsoleMode**](getconsolemode.md) function. The following modes are used with console input handles. 23 | 24 | | Mode | Description | 25 | |-|-| 26 | | **ENABLE\_MOUSE\_INPUT** | Controls whether mouse events are reported in the input buffer. By default, mouse input is enabled and window input is disabled. Changing either of these modes affects only input that occurs after the mode is set; pending mouse or window events in the input buffer are not flushed. The mouse pointer is displayed regardless of the mouse mode. | 27 | | **ENABLE\_WINDOW\_INPUT** | Controls whether buffer-resizing events are reported in the input buffer. By default, mouse input is enabled and window input is disabled. Changing either of these modes affects only input that occurs after the mode is set; pending mouse or window events in the input buffer are not flushed. The mouse pointer is displayed regardless of the mouse mode. | 28 | | **ENABLE\_PROCESSED\_INPUT** | Controls the processing of input for applications using the high-level console I/O functions. However, if processed input mode is enabled, the CTRL+C key combination is not reported in the console's input buffer. Instead, it is passed on to the appropriate control handler function. For more information about control handlers, see [Console Control Handlers](console-control-handlers.md). | 29 | 30 | The output modes of a screen buffer do not affect the behavior of the low-level output functions. 31 | -------------------------------------------------------------------------------- /docs/menu-event-record-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: MENU_EVENT_RECORD structure 3 | description: Describes a menu event in a console INPUT\_RECORD structure. These events are used internally and should be ignored. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - wincontypes/MENU_EVENT_RECORD 10 | - wincon/MENU_EVENT_RECORD 11 | - MENU_EVENT_RECORD 12 | - wincontypes/PMENU_EVENT_RECORD 13 | - wincon/PMENU_EVENT_RECORD 14 | - PMENU_EVENT_RECORD 15 | MS-HAID: 16 | - '\_win32\_menu\_event\_record\_str' 17 | - 'base.menu\_event\_record\_str' 18 | - 'consoles.menu\_event\_record\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: 7efef0e0-01ba-44ba-a972-25c6b3aed2bd 23 | 24 | topic_type: 25 | - apiref 26 | api_name: 27 | - MENU_EVENT_RECORD 28 | api_location: 29 | - WinCon.h 30 | api_type: 31 | - HeaderDef 32 | --- 33 | 34 | # MENU\_EVENT\_RECORD structure 35 | 36 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 37 | 38 | Describes a menu event in a console [**INPUT\_RECORD**](input-record-str.md) structure. These events are used internally and should be ignored. 39 | 40 | ## Syntax 41 | 42 | ```C 43 | typedef struct _MENU_EVENT_RECORD { 44 | UINT dwCommandId; 45 | } MENU_EVENT_RECORD, *PMENU_EVENT_RECORD; 46 | ``` 47 | 48 | ## Members 49 | 50 | **dwCommandId** 51 | Reserved. 52 | 53 | ## Requirements 54 | 55 | |   |   | 56 | |-|-| 57 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 58 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 59 | | Header | WinConTypes.h (via WinCon.h, include Windows.h) | 60 | 61 | ## See also 62 | 63 | [**INPUT\_RECORD**](input-record-str.md) 64 | -------------------------------------------------------------------------------- /docs/peekconsoleinput.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: PeekConsoleInput function 3 | description: Reads data from the specified console input buffer without removing it from the buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi/PeekConsoleInput 10 | - wincon/PeekConsoleInput 11 | - PeekConsoleInput 12 | - consoleapi/PeekConsoleInputA 13 | - wincon/PeekConsoleInputA 14 | - PeekConsoleInputA 15 | - consoleapi/PeekConsoleInputW 16 | - wincon/PeekConsoleInputW 17 | - PeekConsoleInputW 18 | MS-HAID: 19 | - '\_win32\_peekconsoleinput' 20 | - 'base.peekconsoleinput' 21 | - 'consoles.peekconsoleinput' 22 | MSHAttr: 23 | - 'PreferredSiteName:MSDN' 24 | - 'PreferredLib:/library/windows/desktop' 25 | ms.assetid: 9982dc20-43bd-4ee3-a68d-157c9134daca 26 | 27 | topic_type: 28 | - apiref 29 | api_name: 30 | - PeekConsoleInput 31 | - PeekConsoleInputA 32 | - PeekConsoleInputW 33 | api_location: 34 | - Kernel32.dll 35 | - API-MS-Win-Core-Console-l1-1-0.dll 36 | - API-MS-Win-Core-Console-l1-2-0.dll 37 | - KernelBase.dll 38 | - API-MS-Win-Core-Console-l2-1-0.dll 39 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 40 | - MinKernelBase.dll 41 | api_type: 42 | - DllExport 43 | --- 44 | 45 | # PeekConsoleInput function 46 | 47 | Reads data from the specified console input buffer without removing it from the buffer. 48 | 49 | ## Syntax 50 | 51 | ```C 52 | BOOL WINAPI PeekConsoleInput( 53 | _In_  HANDLE        hConsoleInput, 54 | _Out_ PINPUT_RECORD lpBuffer, 55 | _In_  DWORD         nLength, 56 | _Out_ LPDWORD       lpNumberOfEventsRead 57 | ); 58 | ``` 59 | 60 | ## Parameters 61 | 62 | *hConsoleInput* \[in\] 63 | A handle to the console input buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 64 | 65 | *lpBuffer* \[out\] 66 | A pointer to an array of [**INPUT\_RECORD**](input-record-str.md) structures that receives the input buffer data. 67 | 68 | *nLength* \[in\] 69 | The size of the array pointed to by the *lpBuffer* parameter, in array elements. 70 | 71 | *lpNumberOfEventsRead* \[out\] 72 | A pointer to a variable that receives the number of input records read. 73 | 74 | ## Return value 75 | 76 | If the function succeeds, the return value is nonzero. 77 | 78 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 79 | 80 | ## Remarks 81 | 82 | If the number of records requested exceeds the number of records available in the buffer, the number available is read. If no data is available, the function returns immediately. 83 | 84 | [!INCLUDE [setting-codepage-mode-remarks](./includes/setting-codepage-mode-remarks.md)] 85 | 86 | ## Requirements 87 | 88 | |   |   | 89 | |-|-| 90 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 91 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 92 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 93 | | Library | Kernel32.lib | 94 | | DLL | Kernel32.dll | 95 | | Unicode and ANSI names | **PeekConsoleInputW** (Unicode) and **PeekConsoleInputA** (ANSI) | 96 | 97 | ## See also 98 | 99 | [Console Functions](console-functions.md) 100 | 101 | [**ReadConsoleInput**](readconsoleinput.md) 102 | 103 | [**SetConsoleCP**](setconsolecp.md) 104 | 105 | [**SetConsoleOutputCP**](setconsoleoutputcp.md) 106 | 107 | [**WriteConsoleInput**](writeconsoleinput.md) 108 | 109 | [**INPUT\_RECORD**](input-record-str.md) -------------------------------------------------------------------------------- /docs/pseudoconsoles.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Pseudoconsoles – Windows Desktop 3 | description: A pseudoconsole is a concept used to provide the hosting or servicing aspect of a character-mode application. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: conceptual 7 | keywords: console, character mode applications, command line applications, terminal applications, console api, conpty, pseudoconsole 8 | 9 | --- 10 | 11 | # Pseudoconsoles 12 | 13 | A *pseudoconsole* is a device type that allows applications to become the host for character-mode applications. 14 | 15 | This is in contrast to a typical console session where the operating system will create a hosting window on behalf of the character-mode application to handle graphical output and user input. 16 | 17 | With a pseudoconsole, the hosting window is not created. The application that makes the pseudoconsole must become responsible for displaying the graphical output and collecting user input. Alternatively, the information can be relayed further to another application responsible for these activities at a later point in the chain. 18 | 19 | This functionality is designed for third-party "terminal window" applications to exist on the platform or for redirection of character-mode activities to a remote "terminal window" session on another machine or even on another platform. 20 | 21 | Note that the underlying console session will still be created on behalf of the application requesting the pseudoconsole. All the rules of [console sessions](consoles.md) still apply including the ability for multiple client character-mode applications to connect to the session. 22 | 23 | To provide maximum compatibility with the existing world of pseudoterminal functionality, the information provided over the pseudoconsole channel will always be encoded in UTF-8. This does not affect the codepage or encoding of the client applications that are attached. Translation will happen inside the pseudoconsole system as necessary. 24 | 25 | An example for getting started can be found at [Creating a Pseudoconsole Session](creating-a-pseudoconsole-session.md). 26 | 27 | Some additional background information on pseudoconsoles can be found at the announcement blog post: [Windows Command-Line: Introducing the Windows Pseudo Console (ConPTY)](https://blogs.msdn.microsoft.com/commandline/2018/08/02/windows-command-line-introducing-the-windows-pseudo-console-conpty/). 28 | -------------------------------------------------------------------------------- /docs/resizepseudoconsole.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ResizePseudoConsole function 3 | description: See reference information about the ResizePseudoConsole function, which resizes the internal buffers for a pseudoconsole to the given size. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api, conpty, pseudoconsole 8 | f1_keywords: 9 | - consoleapi/ResizePseudoConsole 10 | - ResizePseudoConsole 11 | topic_type: 12 | - apiref 13 | api_name: 14 | - ResizePseudoConsole 15 | api_location: 16 | - Kernel32.dll 17 | - API-MS-Win-Core-Console-l1-2-1.dll 18 | - KernelBase.dll 19 | api_type: 20 | - DllExport 21 | --- 22 | 23 | # ResizePseudoConsole function 24 | 25 | Resizes the internal buffers for a pseudoconsole to the given size. 26 | 27 | ## Syntax 28 | 29 | ```C 30 | HRESULT WINAPI ResizePseudoConsole( 31 | _In_ HPCON hPC , 32 | _In_ COORD size 33 | ); 34 | ``` 35 | 36 | ## Parameters 37 | 38 | *hPC* \[in\] 39 | A handle to an active pseudoconsole as opened by [CreatePseudoConsole](createpseudoconsole.md). 40 | 41 | *size* \[in\] 42 | The dimensions of the window/buffer in count of characters that will be used for the internal buffer of this pseudoconsole. 43 | 44 | ## Return value 45 | 46 | Type: **HRESULT** 47 | 48 | If this method succeeds, it returns **S_OK**. Otherwise, it returns an **HRESULT** error code. 49 | 50 | ## Remarks 51 | 52 | This function can resize the internal buffers in the pseudoconsole session to match the window/buffer size being used for display on the terminal end. This ensures that attached Command-Line Interface (CUI) applications using the [Console Functions](console-functions.md) to communicate will have the correct dimensions returned in their calls. 53 | 54 | ## Requirements 55 | 56 | |   |   | 57 | |-|-| 58 | | Minimum supported client | Windows 10 October 2018 Update (version 1809) \[desktop apps only\] | 59 | | Minimum supported server | Windows Server 2019 \[desktop apps only\] | 60 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 61 | | Library | Kernel32.lib | 62 | | DLL | Kernel32.dll | 63 | 64 | ## See also 65 | 66 | [Pseudoconsoles](pseudoconsoles.md) 67 | 68 | [**CreatePseudoConsole**](createpseudoconsole.md) 69 | 70 | [**ClosePseudoConsole**](closepseudoconsole.md) 71 | -------------------------------------------------------------------------------- /docs/setconsoleactivescreenbuffer.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetConsoleActiveScreenBuffer function 3 | description: Sets the specified screen buffer to be the currently displayed console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/SetConsoleActiveScreenBuffer 10 | - wincon/SetConsoleActiveScreenBuffer 11 | - SetConsoleActiveScreenBuffer 12 | MS-HAID: 13 | - '\_win32\_setconsoleactivescreenbuffer' 14 | - 'base.setconsoleactivescreenbuffer' 15 | - 'consoles.setconsoleactivescreenbuffer' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: c026cb94-c8ec-44ee-b432-3870ae3006c2 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - SetConsoleActiveScreenBuffer 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l2-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | api_type: 31 | - DllExport 32 | --- 33 | 34 | # SetConsoleActiveScreenBuffer function 35 | 36 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 37 | 38 | Sets the specified screen buffer to be the currently displayed console screen buffer. 39 | 40 | ## Syntax 41 | 42 | ```C 43 | BOOL WINAPI SetConsoleActiveScreenBuffer( 44 | _In_ HANDLE hConsoleOutput 45 | ); 46 | ``` 47 | 48 | ## Parameters 49 | 50 | *hConsoleOutput* \[in\] 51 | A handle to the console screen buffer. 52 | 53 | ## Return value 54 | 55 | If the function succeeds, the return value is nonzero. 56 | 57 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 58 | 59 | ## Remarks 60 | 61 | A console can have multiple screen buffers. **SetConsoleActiveScreenBuffer** determines which one is displayed. You can write to an inactive screen buffer and then use **SetConsoleActiveScreenBuffer** to display the buffer's contents. 62 | 63 | [!INCLUDE [no-vt-equiv-alt-buf](./includes/no-vt-equiv-alt-buf.md)] 64 | 65 | ## Examples 66 | 67 | For an example, see [Reading and Writing Blocks of Characters and Attributes](reading-and-writing-blocks-of-characters-and-attributes.md). 68 | 69 | ## Requirements 70 | 71 | |   |   | 72 | |-|-| 73 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 74 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 75 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 76 | | Library | Kernel32.lib | 77 | | DLL | Kernel32.dll | 78 | 79 | ## See also 80 | 81 | [Console Functions](console-functions.md) 82 | 83 | [Console Screen Buffers](console-screen-buffers.md) 84 | 85 | [**CreateConsoleScreenBuffer**](createconsolescreenbuffer.md) -------------------------------------------------------------------------------- /docs/setconsolecp.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetConsoleCP function 3 | description: Sets the input code page used by the console associated with the calling process. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/SetConsoleCP 10 | - wincon/SetConsoleCP 11 | - SetConsoleCP 12 | MS-HAID: 13 | - '\_win32\_setconsolecp' 14 | - 'base.setconsolecp' 15 | - 'consoles.setconsolecp' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 6a1a9ba5-c792-491d-ae51-979f462dcb53 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - SetConsoleCP 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l2-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | api_type: 31 | - DllExport 32 | --- 33 | 34 | # SetConsoleCP function 35 | 36 | Sets the input code page used by the console associated with the calling process. A console uses its input code page to translate keyboard input into the corresponding character value. 37 | 38 | ## Syntax 39 | 40 | ```C 41 | BOOL WINAPI SetConsoleCP( 42 | _In_ UINT wCodePageID 43 | ); 44 | ``` 45 | 46 | ## Parameters 47 | 48 | *wCodePageID* \[in\] 49 | The identifier of the code page to be set. For more information, see Remarks. 50 | 51 | ## Return value 52 | 53 | If the function succeeds, the return value is nonzero. 54 | 55 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 56 | 57 | ## Remarks 58 | 59 | A code page maps 256 character codes to individual characters. Different code pages include different special characters, typically customized for a language or a group of languages. 60 | 61 | To find the code pages that are installed or supported by the operating system, use the [**EnumSystemCodePages**](/windows/win32/api/winnls/nf-winnls-enumsystemcodepagesa) function. The identifiers of the code pages available on the local computer are also stored in the registry under the following key: 62 | 63 | `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage` 64 | 65 | However, it is better to use [**EnumSystemCodePages**](/windows/win32/api/winnls/nf-winnls-enumsystemcodepagesa) to enumerate code pages because the registry can differ in different versions of Windows. 66 | 67 | To determine whether a particular code page is valid, use the [**IsValidCodePage**](/windows/win32/api/winnls/nf-winnls-isvalidcodepage) function. To retrieve more information about a code page, including its name, use the [**GetCPInfoEx**](/windows/win32/api/winnls/nf-winnls-getcpinfoexa) function. For a list of available code page identifiers, see [Code Page Identifiers](/windows/win32/intl/code-page-identifiers). 68 | 69 | To determine a console's current input code page, use the [**GetConsoleCP**](getconsolecp.md) function. To set and retrieve a console's output code page, use the [**SetConsoleOutputCP**](setconsoleoutputcp.md) and [**GetConsoleOutputCP**](getconsoleoutputcp.md) functions. 70 | 71 | ## Requirements 72 | 73 | |   |   | 74 | |-|-| 75 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 76 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 77 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 78 | | Library | Kernel32.lib | 79 | | DLL | Kernel32.dll | 80 | 81 | ## See also 82 | 83 | [Console Code Pages](console-code-pages.md) 84 | 85 | [Console Functions](console-functions.md) 86 | 87 | [**GetConsoleCP**](getconsolecp.md) 88 | 89 | [**GetConsoleOutputCP**](getconsoleoutputcp.md) 90 | 91 | [**SetConsoleOutputCP**](setconsoleoutputcp.md) -------------------------------------------------------------------------------- /docs/setconsolecursorinfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetConsoleCursorInfo function 3 | description: Sets the size and visibility of the cursor for the specified console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/SetConsoleCursorInfo 10 | - wincon/SetConsoleCursorInfo 11 | - SetConsoleCursorInfo 12 | MS-HAID: 13 | - '\_win32\_setconsolecursorinfo' 14 | - 'base.setconsolecursorinfo' 15 | - 'consoles.setconsolecursorinfo' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: c98cbffb-18de-41e8-bba7-5fb46a0c5d25 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - SetConsoleCursorInfo 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l2-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | api_type: 31 | - DllExport 32 | --- 33 | 34 | # SetConsoleCursorInfo function 35 | 36 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 37 | 38 | Sets the size and visibility of the cursor for the specified console screen buffer. 39 | 40 | ## Syntax 41 | 42 | ```C 43 | BOOL WINAPI SetConsoleCursorInfo( 44 | _In_       HANDLE              hConsoleOutput, 45 | _In_ const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo 46 | ); 47 | ``` 48 | 49 | ## Parameters 50 | 51 | *hConsoleOutput* \[in\] 52 | A handle to the console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 53 | 54 | *lpConsoleCursorInfo* \[in\] 55 | A pointer to a [**CONSOLE\_CURSOR\_INFO**](console-cursor-info-str.md) structure that provides the new specifications for the console screen buffer's cursor. 56 | 57 | ## Return value 58 | 59 | If the function succeeds, the return value is nonzero. 60 | 61 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 62 | 63 | ## Remarks 64 | 65 | When a screen buffer's cursor is visible, its appearance can vary, ranging from completely filling a character cell to showing up as a horizontal line at the bottom of the cell. The **dwSize** member of the [**CONSOLE\_CURSOR\_INFO**](console-cursor-info-str.md) structure specifies the percentage of a character cell that is filled by the cursor. If this member is less than 1 or greater than 100, **SetConsoleCursorInfo** fails. 66 | 67 | > [!TIP] 68 | > This API has a **[virtual terminal](console-virtual-terminal-sequences.md)** equivalent in the **[cursor visibility](console-virtual-terminal-sequences.md#cursor-visibility)** section with the `^[[?25h` and `^[[?25l` sequences. 69 | 70 | ## Requirements 71 | 72 | |   |   | 73 | |-|-| 74 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 75 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 76 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 77 | | Library | Kernel32.lib | 78 | | DLL | Kernel32.dll | 79 | 80 | ## See also 81 | 82 | [Console Functions](console-functions.md) 83 | 84 | [Console Screen Buffers](console-screen-buffers.md) 85 | 86 | [**CONSOLE\_CURSOR\_INFO**](console-cursor-info-str.md) 87 | 88 | [**GetConsoleCursorInfo**](getconsolecursorinfo.md) 89 | 90 | [**SetConsoleCursorPosition**](setconsolecursorposition.md) -------------------------------------------------------------------------------- /docs/setconsoledisplaymode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetConsoleDisplayMode function 3 | description: See reference information about the SetConsoleDisplayMode function, which sets the display mode of the specified console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/SetConsoleDisplayMode 10 | - wincon/SetConsoleDisplayMode 11 | - SetConsoleDisplayMode 12 | MS-HAID: 13 | - 'base.setconsoledisplaymode' 14 | - 'consoles.setconsoledisplaymode' 15 | MSHAttr: 16 | - 'PreferredSiteName:MSDN' 17 | - 'PreferredLib:/library/windows/desktop' 18 | ms.assetid: 27437a85-f784-41fc-8279-9fe089b0a744 19 | 20 | topic_type: 21 | - apiref 22 | api_name: 23 | - SetConsoleDisplayMode 24 | api_location: 25 | - Kernel32.dll 26 | api_type: 27 | - DllExport 28 | --- 29 | 30 | # SetConsoleDisplayMode function 31 | 32 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 33 | 34 | Sets the display mode of the specified console screen buffer. 35 | 36 | ## Syntax 37 | 38 | ```C 39 | BOOL WINAPI SetConsoleDisplayMode( 40 | _In_      HANDLE hConsoleOutput, 41 | _In_      DWORD  dwFlags, 42 | _Out_opt_ PCOORD lpNewScreenBufferDimensions 43 | ); 44 | ``` 45 | 46 | ## Parameters 47 | 48 | *hConsoleOutput* \[in\] 49 | A handle to the console screen buffer. 50 | 51 | *dwFlags* \[in\] 52 | The display mode of the console. This parameter can be one or more of the following values. 53 | 54 | | Value | Meaning | 55 | |-|-| 56 | | **CONSOLE_FULLSCREEN_MODE** 1 | Text is displayed in full-screen mode. | 57 | | **CONSOLE_WINDOWED_MODE** 2 | Text is displayed in a console window. | 58 | 59 | *lpNewScreenBufferDimensions* \[out, optional\] 60 | A pointer to a [**COORD**](coord-str.md) structure that receives the new dimensions of the screen buffer, in characters. 61 | 62 | ## Return value 63 | 64 | If the function succeeds, the return value is nonzero. 65 | 66 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 67 | 68 | ## Remarks 69 | 70 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 71 | 72 | ## Requirements 73 | 74 | |   |   | 75 | |-|-| 76 | | Minimum supported client | Windows XP \[desktop apps only\] | 77 | | Minimum supported server | Windows Server 2003 \[desktop apps only\] | 78 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 79 | | Library | Kernel32.lib | 80 | | DLL | Kernel32.dll | 81 | 82 | ## See also 83 | 84 | [Console Functions](console-functions.md) 85 | 86 | [Console Modes](console-modes.md) 87 | 88 | [**GetConsoleDisplayMode**](getconsoledisplaymode.md) -------------------------------------------------------------------------------- /docs/setconsolehistoryinfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetConsoleHistoryInfo function 3 | description: Sets the history settings for the Windows Console of the calling process. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/SetConsoleHistoryInfo 10 | - wincon/SetConsoleHistoryInfo 11 | - SetConsoleHistoryInfo 12 | MS-HAID: 13 | - 'base.setconsolehistoryinfo' 14 | - 'consoles.setconsolehistoryinfo' 15 | MSHAttr: 16 | - 'PreferredSiteName:MSDN' 17 | - 'PreferredLib:/library/windows/desktop' 18 | ms.assetid: db180f53-aa3c-4a91-bc3e-9f3f0bb7ab01 19 | 20 | topic_type: 21 | - apiref 22 | api_name: 23 | - SetConsoleHistoryInfo 24 | api_location: 25 | - Kernel32.dll 26 | api_type: 27 | - DllExport 28 | --- 29 | 30 | # SetConsoleHistoryInfo function 31 | 32 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 33 | 34 | Sets the history settings for the calling process's console. 35 | 36 | ## Syntax 37 | 38 | ```C 39 | BOOL WINAPI SetConsoleHistoryInfo( 40 | _In_ PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo 41 | ); 42 | ``` 43 | 44 | ## Parameters 45 | 46 | *lpConsoleHistoryInfo* \[in\] 47 | A pointer to a [**CONSOLE\_HISTORY\_INFO**](console-history-info.md) structure that contains the history settings for the process's console. 48 | 49 | ## Return value 50 | 51 | If the function succeeds, the return value is nonzero. 52 | 53 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 54 | 55 | ## Remarks 56 | 57 | If the calling process is not a console process, the function fails and sets the last error code to **ERROR\_ACCESS\_DENIED**. 58 | 59 | [!INCLUDE [no-vt-equiv-shell-banner](./includes/no-vt-equiv-shell-banner.md)] 60 | 61 | ## Requirements 62 | 63 | |   |   | 64 | |-|-| 65 | | Minimum supported client | Windows Vista \[desktop apps only\] | 66 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 67 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 68 | | Library | Kernel32.lib | 69 | | DLL | Kernel32.dll | 70 | 71 | ## See also 72 | 73 | [Console Functions](console-functions.md) 74 | 75 | [**CONSOLE\_HISTORY\_INFO**](console-history-info.md) 76 | 77 | [**GetConsoleHistoryInfo**](getconsolehistoryinfo.md) -------------------------------------------------------------------------------- /docs/setconsolemode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetConsoleMode function 3 | description: Sets the input mode of a console's input buffer or the output mode of a console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi/SetConsoleMode 10 | - wincon/SetConsoleMode 11 | - SetConsoleMode 12 | MS-HAID: 13 | - '\_win32\_setconsolemode' 14 | - 'base.setconsolemode' 15 | - 'consoles.setconsolemode' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 77508d58-8a7a-4c47-9ec5-dc61e5c4beac 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - SetConsoleMode 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l1-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | - MinKernelBase.dll 31 | api_type: 32 | - DllExport 33 | --- 34 | 35 | # SetConsoleMode function 36 | 37 | Sets the input mode of a console's input buffer or the output mode of a console screen buffer. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | BOOL WINAPI SetConsoleMode( 43 | _In_ HANDLE hConsoleHandle, 44 | _In_ DWORD  dwMode 45 | ); 46 | ``` 47 | 48 | ## Parameters 49 | 50 | *hConsoleHandle* \[in\] 51 | A handle to the console input buffer or a console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 52 | 53 | *dwMode* \[in\] 54 | The input or output mode to be set. 55 | 56 | [!INCLUDE [console-mode-flags](./includes/console-mode-flags.md)] 57 | 58 | ## Return value 59 | 60 | If the function succeeds, the return value is nonzero. 61 | 62 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 63 | 64 | ## Remarks 65 | 66 | [!INCLUDE [console-mode-remarks](./includes/console-mode-remarks.md)] 67 | 68 | To determine the current mode of a console input buffer or a screen buffer, use the [**GetConsoleMode**](getconsolemode.md) function. 69 | 70 | ## Examples 71 | 72 | For an example, see [Reading Input Buffer Events](reading-input-buffer-events.md). 73 | 74 | ## Requirements 75 | 76 | |   |   | 77 | |-|-| 78 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 79 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 80 | | Header | ConsoleApi.h (via WinCon.h, include Windows.h) | 81 | | Library | Kernel32.lib | 82 | | DLL | Kernel32.dll | 83 | 84 | ## See also 85 | 86 | [Console Functions](console-functions.md) 87 | 88 | [Console Modes](console-modes.md) 89 | 90 | [**GetConsoleMode**](getconsolemode.md) 91 | 92 | [**HandlerRoutine**](handlerroutine.md) 93 | 94 | [**ReadConsole**](readconsole.md) 95 | 96 | [**ReadConsoleInput**](readconsoleinput.md) 97 | 98 | [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) 99 | 100 | [**WriteConsole**](writeconsole.md) 101 | 102 | [**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile) 103 | -------------------------------------------------------------------------------- /docs/setconsolescreenbufferinfoex.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetConsoleScreenBufferInfoEx function 3 | description: Sets extended information about the specified console screen buffer to the specified buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/SetConsoleScreenBufferInfoEx 10 | - wincon/SetConsoleScreenBufferInfoEx 11 | - SetConsoleScreenBufferInfoEx 12 | MS-HAID: 13 | - 'base.setconsolescreenbufferinfoex' 14 | - 'consoles.setconsolescreenbufferinfoex' 15 | MSHAttr: 16 | - 'PreferredSiteName:MSDN' 17 | - 'PreferredLib:/library/windows/desktop' 18 | ms.assetid: ff851144-eee9-4410-8fd1-28aa24fc25f1 19 | 20 | topic_type: 21 | - apiref 22 | api_name: 23 | - SetConsoleScreenBufferInfoEx 24 | api_location: 25 | - Kernel32.dll 26 | - API-MS-Win-Core-Console-l2-1-0.dll 27 | - KernelBase.dll 28 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 29 | api_type: 30 | - DllExport 31 | --- 32 | 33 | # SetConsoleScreenBufferInfoEx function 34 | 35 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 36 | 37 | Sets extended information about the specified console screen buffer. 38 | 39 | ## Syntax 40 | 41 | ```C 42 | BOOL WINAPI SetConsoleScreenBufferInfoEx( 43 | _In_ HANDLE                        hConsoleOutput, 44 | _In_ PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx 45 | ); 46 | ``` 47 | 48 | ## Parameters 49 | 50 | *hConsoleOutput* \[in\] 51 | A handle to the console screen buffer. The handle must have the **GENERIC\_WRITE** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 52 | 53 | *lpConsoleScreenBufferInfoEx* \[in\] 54 | A [**CONSOLE\_SCREEN\_BUFFER\_INFOEX**](console-screen-buffer-infoex.md) structure that contains the console screen buffer information. 55 | 56 | ## Return value 57 | 58 | If the function succeeds, the return value is nonzero. 59 | 60 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 61 | 62 | ## Remarks 63 | 64 | > [!TIP] 65 | > This API has a partial **[virtual terminal](console-virtual-terminal-sequences.md)** equivalent. **[Cursor positioning buffer](console-virtual-terminal-sequences.md#cursor-positioning)** and **[text attributes](console-virtual-terminal-sequences.md#text-formatting)** have specific sequence equivalents. The color table is not configurable, but **[extended colors](console-virtual-terminal-sequences.md#extended-colors)** are available beyond what is normally available through **[console functions](console-functions.md)**. Popup attributes have no equivalent as popup menus are the responsibility of the command-line client application in the **virtual terminal** world. Finally, the size of the window and the full screen status are considered privileges owned by the user in the **virtual terminal** world and have no equivalent sequence. 66 | 67 | ## Requirements 68 | 69 | |   |   | 70 | |-|-| 71 | | Minimum supported client | Windows Vista \[desktop apps only\] | 72 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 73 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 74 | | Library | Kernel32.lib | 75 | | DLL | Kernel32.dll | 76 | 77 | ## See also 78 | 79 | [Console Functions](console-functions.md) 80 | 81 | [**CONSOLE\_SCREEN\_BUFFER\_INFOEX**](console-screen-buffer-infoex.md) 82 | 83 | [**GetConsoleScreenBufferInfoEx**](getconsolescreenbufferinfoex.md) -------------------------------------------------------------------------------- /docs/setconsolescreenbuffersize.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetConsoleScreenBufferSize function 3 | description: See reference information about the SetConsoleScreenBufferSize function, which changes the size of the specified console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/SetConsoleScreenBufferSize 10 | - wincon/SetConsoleScreenBufferSize 11 | - SetConsoleScreenBufferSize 12 | MS-HAID: 13 | - '\_win32\_setconsolescreenbuffersize' 14 | - 'base.setconsolescreenbuffersize' 15 | - 'consoles.setconsolescreenbuffersize' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 50bf1973-5604-42fe-bbeb-611ddc240bdd 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - SetConsoleScreenBufferSize 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l2-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | api_type: 31 | - DllExport 32 | --- 33 | 34 | # SetConsoleScreenBufferSize function 35 | 36 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 37 | 38 | Changes the size of the specified console screen buffer. 39 | 40 | ## Syntax 41 | 42 | ```C 43 | BOOL WINAPI SetConsoleScreenBufferSize( 44 | _In_ HANDLE hConsoleOutput, 45 | _In_ COORD  dwSize 46 | ); 47 | ``` 48 | 49 | ## Parameters 50 | 51 | *hConsoleOutput* \[in\] 52 | A handle to the console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 53 | 54 | *dwSize* \[in\] 55 | A [**COORD**](coord-str.md) structure that specifies the new size of the console screen buffer, in character rows and columns. The specified width and height cannot be less than the width and height of the console screen buffer's window. The specified dimensions also cannot be less than the minimum size allowed by the system. This minimum depends on the current font size for the console (selected by the user) and the **SM\_CXMIN** and **SM\_CYMIN** values returned by the [**GetSystemMetrics**](/windows/win32/api/winuser/nf-winuser-getsystemmetrics) function. 56 | 57 | ## Return value 58 | 59 | If the function succeeds, the return value is nonzero. 60 | 61 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 62 | 63 | ## Remarks 64 | 65 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 66 | 67 | ## Requirements 68 | 69 | |   |   | 70 | |-|-| 71 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 72 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 73 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 74 | | Library | Kernel32.lib | 75 | | DLL | Kernel32.dll | 76 | 77 | ## See also 78 | 79 | [Console Functions](console-functions.md) 80 | 81 | [Console Input Buffer](console-input-buffer.md) 82 | 83 | [**COORD**](coord-str.md) 84 | 85 | [**GetConsoleScreenBufferInfo**](getconsolescreenbufferinfo.md) 86 | 87 | [**SetConsoleWindowInfo**](setconsolewindowinfo.md) -------------------------------------------------------------------------------- /docs/setconsoletextattribute.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetConsoleTextAttribute function 3 | description: Sets the attributes of characters written to the console screen buffer by the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi2/SetConsoleTextAttribute 10 | - wincon/SetConsoleTextAttribute 11 | - SetConsoleTextAttribute 12 | MS-HAID: 13 | - '\_win32\_setconsoletextattribute' 14 | - 'base.setconsoletextattribute' 15 | - 'consoles.setconsoletextattribute' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 9fba5bb5-b999-4abd-ab39-7a63d58b8074 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - SetConsoleTextAttribute 25 | api_location: 26 | - Kernel32.dll 27 | - API-MS-Win-Core-Console-l2-1-0.dll 28 | - KernelBase.dll 29 | - API-MS-Win-DownLevel-Kernel32-l1-1-0.dll 30 | api_type: 31 | - DllExport 32 | --- 33 | 34 | # SetConsoleTextAttribute function 35 | 36 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 37 | 38 | Sets the attributes of characters written to the console screen buffer by the [**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile) or [**WriteConsole**](writeconsole.md) function, or echoed by the [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) or [**ReadConsole**](readconsole.md) function. This function affects text written after the function call. 39 | 40 | ## Syntax 41 | 42 | ```C 43 | BOOL WINAPI SetConsoleTextAttribute( 44 | _In_ HANDLE hConsoleOutput, 45 | _In_ WORD   wAttributes 46 | ); 47 | ``` 48 | 49 | ## Parameters 50 | 51 | *hConsoleOutput* \[in\] 52 | A handle to the console screen buffer. The handle must have the **GENERIC\_READ** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 53 | 54 | *wAttributes* \[in\] 55 | The [character attributes](console-screen-buffers.md#character-attributes). 56 | 57 | ## Return value 58 | 59 | If the function succeeds, the return value is nonzero. 60 | 61 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 62 | 63 | ## Remarks 64 | 65 | To determine the current color attributes of a screen buffer, call the [**GetConsoleScreenBufferInfo**](getconsolescreenbufferinfo.md) function. 66 | 67 | > [!TIP] 68 | > This API has a **[virtual terminal](console-virtual-terminal-sequences.md)** equivalent in the **[text formatting](console-virtual-terminal-sequences.md#text-formatting)** sequences. _Virtual terminal sequences_ are recommended for all new and ongoing development. 69 | 70 | ## Examples 71 | 72 | For an example, see [Using the High-Level Input and Output Functions](using-the-high-level-input-and-output-functions.md). 73 | 74 | ## Requirements 75 | 76 | |   |   | 77 | |-|-| 78 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 79 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 80 | | Header | ConsoleApi2.h (via WinCon.h, include Windows.h) | 81 | | Library | Kernel32.lib | 82 | | DLL | Kernel32.dll | 83 | 84 | ## See also 85 | 86 | [Console Functions](console-functions.md) 87 | 88 | [Console Screen Buffers](console-screen-buffers.md) 89 | 90 | [**GetConsoleScreenBufferInfo**](getconsolescreenbufferinfo.md) 91 | 92 | [**ReadConsole**](readconsole.md) 93 | 94 | [**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile) 95 | 96 | [**WriteConsole**](writeconsole.md) 97 | 98 | [**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile) -------------------------------------------------------------------------------- /docs/setcurrentconsolefontex.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SetCurrentConsoleFontEx function 3 | description: See reference information about the SetCurrentConsoleFontEx function, which sets extended information about the current console font. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - consoleapi3/SetCurrentConsoleFontEx 10 | - wincon/SetCurrentConsoleFontEx 11 | - SetCurrentConsoleFontEx 12 | MS-HAID: 13 | - 'base.setcurrentconsolefontex' 14 | - 'consoles.setcurrentconsolefontex' 15 | MSHAttr: 16 | - 'PreferredSiteName:MSDN' 17 | - 'PreferredLib:/library/windows/desktop' 18 | ms.assetid: fbc31e2a-31df-4e9e-9f61-35a4ff812f8f 19 | 20 | topic_type: 21 | - apiref 22 | api_name: 23 | - SetCurrentConsoleFontEx 24 | api_location: 25 | - Kernel32.dll 26 | api_type: 27 | - DllExport 28 | --- 29 | 30 | # SetCurrentConsoleFontEx function 31 | 32 | [!INCLUDE [not-recommended-banner](./includes/not-recommended-banner.md)] 33 | 34 | Sets extended information about the current console font. 35 | 36 | ## Syntax 37 | 38 | ```C 39 | BOOL WINAPI SetCurrentConsoleFontEx( 40 | _In_ HANDLE               hConsoleOutput, 41 | _In_ BOOL                 bMaximumWindow, 42 | _In_ PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx 43 | ); 44 | ``` 45 | 46 | ## Parameters 47 | 48 | *hConsoleOutput* \[in\] 49 | A handle to the console screen buffer. The handle must have the **GENERIC\_WRITE** access right. For more information, see [Console Buffer Security and Access Rights](console-buffer-security-and-access-rights.md). 50 | 51 | *bMaximumWindow* \[in\] 52 | If this parameter is **TRUE**, font information is set for the maximum window size. If this parameter is **FALSE**, font information is set for the current window size. 53 | 54 | *lpConsoleCurrentFontEx* \[in\] 55 | A pointer to a [**CONSOLE\_FONT\_INFOEX**](console-font-infoex.md) structure that contains the font information. 56 | 57 | ## Return value 58 | 59 | If the function succeeds, the return value is nonzero. 60 | 61 | If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror). 62 | 63 | ## Remarks 64 | 65 | To compile an application that uses this function, define **\_WIN32\_WINNT** as 0x0500 or later. For more information, see [Using the Windows Headers](/windows/win32/winprog/using-the-windows-headers). 66 | 67 | [!INCLUDE [no-vt-equiv-user-priv](./includes/no-vt-equiv-user-priv.md)] 68 | 69 | ## Requirements 70 | 71 | |   |   | 72 | |-|-| 73 | | Minimum supported client | Windows Vista \[desktop apps only\] | 74 | | Minimum supported server | Windows Server 2008 \[desktop apps only\] | 75 | | Header | ConsoleApi3.h (via WinCon.h, include Windows.h) | 76 | | Library | Kernel32.lib | 77 | | DLL | Kernel32.dll | 78 | 79 | ## See also 80 | 81 | [Console Functions](console-functions.md) 82 | 83 | [**CONSOLE\_FONT\_INFOEX**](console-font-infoex.md) -------------------------------------------------------------------------------- /docs/small-rect-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | author: miniksa 3 | ms.author: miniksa 4 | ms.topic: article 5 | keywords: console, character mode applications, command line applications, terminal applications, console api 6 | f1_keywords: 7 | - wincontypes/SMALL_RECT 8 | - wincon/SMALL_RECT 9 | - SMALL_RECT 10 | title: SMALL_RECT structure 11 | description: Defines the coordinates of the upper left and lower right corners of a rectangle. 12 | MS-HAID: 13 | - '\_win32\_small\_rect\_str' 14 | - 'base.small\_rect\_str' 15 | - 'consoles.small\_rect\_str' 16 | MSHAttr: 17 | - 'PreferredSiteName:MSDN' 18 | - 'PreferredLib:/library/windows/desktop' 19 | ms.assetid: 62639815-c7e9-4ae2-b152-61290f78422b 20 | 21 | topic_type: 22 | - apiref 23 | api_name: 24 | - SMALL_RECT 25 | api_location: 26 | - WinCon.h 27 | api_type: 28 | - HeaderDef 29 | --- 30 | 31 | # SMALL\_RECT structure 32 | 33 | Defines the coordinates of the upper left and lower right corners of a rectangle. 34 | 35 | ## Syntax 36 | 37 | ```C 38 | typedef struct _SMALL_RECT { 39 | SHORT Left; 40 | SHORT Top; 41 | SHORT Right; 42 | SHORT Bottom; 43 | } SMALL_RECT; 44 | ``` 45 | 46 | ## Members 47 | 48 | **Left** 49 | The x-coordinate of the upper left corner of the rectangle. 50 | 51 | **Top** 52 | The y-coordinate of the upper left corner of the rectangle. 53 | 54 | **Right** 55 | The x-coordinate of the lower right corner of the rectangle. 56 | 57 | **Bottom** 58 | The y-coordinate of the lower right corner of the rectangle. 59 | 60 | ## Remarks 61 | 62 | This structure is used by console functions to specify rectangular areas of console screen buffers, where the coordinates specify the rows and columns of screen-buffer character cells. 63 | 64 | ## Examples 65 | 66 | For an example, see [Scrolling a Screen Buffer's Contents](scrolling-a-screen-buffer-s-contents.md). 67 | 68 | ## Requirements 69 | 70 | |   |   | 71 | |-|-| 72 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 73 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 74 | | Header | WinConTypes.h (via WinCon.h, include Windows.h) | 75 | 76 | ## See also 77 | 78 | [**RECT**](/previous-versions//dd162897(v=vs.85)) 79 | 80 | [**RECTL**](/previous-versions//dd162907(v=vs.85)) -------------------------------------------------------------------------------- /docs/using-the-console.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Using the Console 3 | description: The following examples demonstrate how to use various console functions. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: reference 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | MS-HAID: 9 | - '\_win32\_using\_the\_console' 10 | - 'base.using\_the\_console' 11 | - 'consoles.using\_the\_console' 12 | MSHAttr: 13 | - 'PreferredSiteName:MSDN' 14 | - 'PreferredLib:/library/windows/desktop' 15 | ms.assetid: 31bbf2b1-2519-4589-8059-7757cfda105a 16 | --- 17 | 18 | # Using the Console 19 | 20 | The following examples demonstrate how to use the console functions: 21 | 22 | - [Using the high-level input and output functions](using-the-high-level-input-and-output-functions.md) 23 | - [Reading and writing blocks of characters and attributes](reading-and-writing-blocks-of-characters-and-attributes.md) 24 | - [Reading input buffer events](reading-input-buffer-events.md) 25 | - [Clearing the screen](clearing-the-screen.md) 26 | - [Scrolling a screen buffer's window](scrolling-a-screen-buffer-s-window.md) 27 | - [Scrolling a screen buffer's contents](scrolling-a-screen-buffer-s-contents.md) 28 | - [Registering a control handler function](registering-a-control-handler-function.md) 29 | -------------------------------------------------------------------------------- /docs/window-buffer-size-record-str.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: WINDOW_BUFFER_SIZE_RECORD structure 3 | description: See reference information about the WINDOW_BUFFER_SIZE_RECORD structure, which describes a change in the size of the console screen buffer. 4 | author: miniksa 5 | ms.author: miniksa 6 | ms.topic: article 7 | keywords: console, character mode applications, command line applications, terminal applications, console api 8 | f1_keywords: 9 | - wincontypes/WINDOW_BUFFER_SIZE_RECORD 10 | - wincon/WINDOW_BUFFER_SIZE_RECORD 11 | - WINDOW_BUFFER_SIZE_RECORD 12 | - wincontypes/PWINDOW_BUFFER_SIZE_RECORD 13 | - wincon/PWINDOW_BUFFER_SIZE_RECORD 14 | - PWINDOW_BUFFER_SIZE_RECORD 15 | MS-HAID: 16 | - '\_win32\_window\_buffer\_size\_record\_str' 17 | - 'base.window\_buffer\_size\_record\_str' 18 | - 'consoles.window\_buffer\_size\_record\_str' 19 | MSHAttr: 20 | - 'PreferredSiteName:MSDN' 21 | - 'PreferredLib:/library/windows/desktop' 22 | ms.assetid: 2f2875e8-aa09-455b-a923-7cc388525b98 23 | 24 | topic_type: 25 | - apiref 26 | api_name: 27 | - WINDOW_BUFFER_SIZE_RECORD 28 | api_location: 29 | - WinCon.h 30 | api_type: 31 | - HeaderDef 32 | --- 33 | 34 | # WINDOW\_BUFFER\_SIZE\_RECORD structure 35 | 36 | Describes a change in the size of the console screen buffer. 37 | 38 | ## Syntax 39 | 40 | ```C 41 | typedef struct _WINDOW_BUFFER_SIZE_RECORD { 42 | COORD dwSize; 43 | } WINDOW_BUFFER_SIZE_RECORD; 44 | ``` 45 | 46 | ## Members 47 | 48 | **dwSize** 49 | A [**COORD**](coord-str.md) structure that contains the size of the console screen buffer, in character cell columns and rows. 50 | 51 | ## Remarks 52 | 53 | Buffer size events are placed in the input buffer when the console is in window-aware mode (**ENABLE\_WINDOW\_INPUT**). 54 | 55 | ## Examples 56 | 57 | For an example, see [Reading Input Buffer Events](reading-input-buffer-events.md). 58 | 59 | ## Requirements 60 | 61 | |   |   | 62 | |-|-| 63 | | Minimum supported client | Windows 2000 Professional \[desktop apps only\] | 64 | | Minimum supported server | Windows 2000 Server \[desktop apps only\] | 65 | | Header | WinConTypes.h (via WinCon.h, include Windows.h) | 66 | 67 | ## See also 68 | 69 | [**COORD**](coord-str.md) 70 | 71 | [**INPUT\_RECORD**](input-record-str.md) 72 | 73 | [**ReadConsoleInput**](readconsoleinput.md) 74 | --------------------------------------------------------------------------------