Retrieves the original title for the current console window.
Syntax
DWORD WINAPI GetConsoleOriginalTitle(
_Out_ LPTSTR lpConsoleTitle,
_In_ DWORD nSize
);
Parameters
lpConsoleTitle [out]
A pointer to a buffer that receives a null-terminated string containing the original title.
The storage for this buffer is allocated from a shared heap for the process that is 64 KB in size. The maximum size of the buffer will depend on heap usage.
nSize [in]
The size of the lpConsoleTitle buffer, in characters.
Return value
If the function succeeds, the return value is the length of the string copied to the buffer, in characters.
If the buffer is not large enough to store the title, the return value is zero and GetLastError returns ERROR_SUCCESS.
If the function fails, the return value is zero and GetLastError returns the error code.
Remarks
To set the title for a console window, use the SetConsoleTitle function. To retrieve the current title string, use the GetConsoleTitle function.
To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or later. For more information, see Using the Windows Headers.
Requirements
Minimum supported client |
Windows Vista [desktop apps only] |
Minimum supported server |
Windows Server 2008 [desktop apps only] |
Header |
Wincon.h (include Windows.h) |
Library |
Kernel32.lib |
DLL |
Kernel32.dll |
Unicode and ANSI names |
GetConsoleOriginalTitleW (Unicode) and GetConsoleOriginalTitleA (ANSI) |


