---
title: GetConsoleMode function
description: Retrieves the current input mode of a console's input buffer or the current output mode of a console screen buffer.
author: miniksa
ms.author: miniksa
ms.topic: article
keywords: console, character mode applications, command line applications, terminal applications, console api
f1_keywords:
- consoleapi/GetConsoleMode
- wincon/GetConsoleMode
- GetConsoleMode
MS-HAID:
- '\_win32\_getconsolemode'
- 'base.getconsolemode'
- 'consoles.getconsolemode'
MSHAttr:
- 'PreferredSiteName:MSDN'
- 'PreferredLib:/library/windows/desktop'
ms.assetid: 49adf618-196d-4490-93ca-cd177807f58e

topic_type:
- apiref
api_name:
- GetConsoleMode
api_location:
- Kernel32.dll
- API-MS-Win-Core-Console-l1-1-0.dll
- KernelBase.dll
- API-MS-Win-DownLevel-Kernel32-l1-1-0.dll
- MinKernelBase.dll
api_type:
- DllExport
---

# GetConsoleMode function

Retrieves the current input mode of a console's input buffer or the current output mode of a console screen buffer.

## Syntax

```C
BOOL WINAPI GetConsoleMode(
  _In_  HANDLE  hConsoleHandle,
  _Out_ LPDWORD lpMode
);
```

## Parameters

*hConsoleHandle* \[in\]  
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).

*lpMode* \[out\]  
A pointer to a variable that receives the current mode of the specified buffer.

[!INCLUDE [console-mode-flags](./includes/console-mode-flags.md)]

## Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call [**GetLastError**](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror).

## Remarks

[!INCLUDE [console-mode-remarks](./includes/console-mode-remarks.md)]

To change a console's I/O modes, call [**SetConsoleMode**](setconsolemode.md) function.

## Examples

For an example, see [Reading Input Buffer Events](reading-input-buffer-events.md).

## Requirements

|   |   |
|-|-|
| Minimum supported client | Windows 2000 Professional \[desktop apps \| UWP apps\] |
| Minimum supported server | Windows 2000 Server \[desktop apps \| UWP apps\] |
| Header | ConsoleApi.h (via WinCon.h, include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |

## See also

[Console Functions](console-functions.md)

[Console Modes](console-modes.md)

[**ReadConsole**](readconsole.md)

[**ReadConsoleInput**](readconsoleinput.md)

[**ReadFile**](/windows/win32/api/fileapi/nf-fileapi-readfile)

[**SetConsoleMode**](setconsolemode.md)

[**WriteConsole**](writeconsole.md)

[**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile)