InternalGetWindowText function (winuser.h)

[This function is not intended for general use. It may be altered or unavailable in subsequent versions of Windows.]

Copies the text of the specified window's title bar (if it has one) into a buffer.

This function is similar to the GetWindowText function. However, it obtains the window text directly from the window structure associated with the specified window's handle and then always provides the text as a Unicode string. This is unlike GetWindowText which obtains the text by sending the window a WM_GETTEXT message. If the specified window is a control, the text of the control is obtained.

Syntax

int InternalGetWindowText(
  [in]  HWND   hWnd,
  [out] LPWSTR pString,
  [in]  int    cchMaxCount
);

Parameters

[in] hWnd

Type: HWND

A handle to the window or control containing the text.

[out] pString

Type: LPWSTR

The buffer that is to receive the text.

If the string is as long or longer than the buffer, the string is truncated and terminated with a null character.

[in] cchMaxCount

Type: int

The maximum number of characters to be copied to the buffer, including the null character. If the text exceeds this limit, it is truncated.

Return value

Type: int

If the function succeeds, the return value is the length, in characters, of the copied string, not including the terminating null character.

If the window has no title bar or text, if the title bar is empty, or if the window or control handle is invalid, the return value is zero. To get extended error information, call GetLastError.

Remarks

This function was not included in the SDK headers and libraries until Windows XP with Service Pack 1 (SP1) and Windows Server 2003. If you do not have a header file and import library for this function, you can call the function using LoadLibrary and GetProcAddress.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Conceptual

GetWindowText

GetWindowTextLength

Reference

SetWindowText

Using Messages and Message Queues

WM_GETTEXT

Windows