Windows Dev Center

Expand Minimize

InternalGetWindowText function

[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 WINAPI InternalGetWindowText(
  _In_  HWND   hWnd,
  _Out_ LPWSTR lpString,
  _In_  int    nMaxCount
);

Parameters

hWnd [in]

Type: HWND

A handle to the window or control containing the text.

lpString [out]

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.

nMaxCount [in]

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:

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

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
GetWindowText
GetWindowTextLength
SetWindowText
WM_GETTEXT
Conceptual
Windows
Using Messages and Message Queues

 

 

Community Additions

ADD
Show:
© 2015 Microsoft