GetConsoleTitle

  DWORD GetConsoleTitle(lpszTitle, cchTitle)    
  LPTSTR lpszTitle; /* address of buffer for title */
  DWORD cchTitle; /* size of the buffer in characters */

The GetConsoleTitle function retrieves the current console window title string.

Parameters

lpszTitle

Points to a buffer that receives the current console title.

cchTitle

Specifies the length of the title buffer in characters.

Return Value

If the function is successful, the return value is the actual length in characters of the string copied to the buffer. Otherwise, it is 0. Use the GetLastError function to obtain extended error information.

Comments

The GetConsoleTitle function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed). Because of the size difference between Unicode and ANSI characters, the cchTitle parameter and the function's return value are in terms of characters rather than bytes.

See Also

SetConsoleTitle