EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

GetConsoleTitle function

Retrieves the title for the current console window.

Syntax


DWORD WINAPI GetConsoleTitle(
  _Out_  LPTSTR lpConsoleTitle,
  _In_   DWORD nSize
);

Parameters

lpConsoleTitle [out]

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.

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 buffer pointed to by the lpConsoleTitle parameter, in characters.

Return value

If the function succeeds, the return value is the length of the console window's title, in characters.

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 original title string, use the GetConsoleOriginalTitle function.

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 or SetConsoleOutputCP functions, or use the chcp or mode con cp select= commands.

Examples

For an example, see SetConsoleTitle.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wincon.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

Unicode and ANSI names

GetConsoleTitleW (Unicode) and GetConsoleTitleA (ANSI)

See also

Console Functions
GetConsoleOriginalTitle
SetConsoleCP
SetConsoleOutputCP
SetConsoleTitle

 

 

Community-Beiträge

HINZUFÜGEN
Anzeigen:
© 2014 Microsoft