User32InternalGetWindowText Method
Copies the text of the specified window's title bar (if it has one) into a buffer.
This function is similar to the
GetWindowText(IntPtr, StringBuilder, Int32) 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(IntPtr, StringBuilder, Int32) 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.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", ExactSpelling = true, SetLastError = true)]
public static int InternalGetWindowText(
IntPtr hWnd,
StringBuilder buffer,
int maxCount
)
<DllImportAttribute("User32.dll", ExactSpelling := true, SetLastError := true>]
Public Shared Function InternalGetWindowText (
hWnd As IntPtr,
buffer As StringBuilder,
maxCount As Integer
) As Integer
Dim hWnd As IntPtr
Dim buffer As StringBuilder
Dim maxCount As Integer
Dim returnValue As Integer
returnValue = User32.InternalGetWindowText(hWnd,
buffer, maxCount)
public:
[DllImportAttribute(L"User32.dll", ExactSpelling = true, SetLastError = true)]
static int InternalGetWindowText(
IntPtr hWnd,
StringBuilder^ buffer,
int maxCount
)
[<DllImportAttribute("User32.dll", ExactSpelling = true, SetLastError = true)>]
static member InternalGetWindowText :
hWnd : IntPtr *
buffer : StringBuilder *
maxCount : int -> int
No code example is currently available or this language may not be supported.
- hWnd IntPtr
-
A handle to the window or control containing the text.
- buffer StringBuilder
-
The buffer that is to receive the text.
- maxCount Int32
-
The maximum number of characters to be copied to the buffer, including the null character.
If the text exceeds this limit, it is truncated
Int32
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
.
To get extended error information, call
GetLastWin32Error.