User32GetWindowTextLength Method
Retrieves the length, in characters, of the specified window's title bar text (if the window has a title bar).
If the specified window is a control, the function retrieves the length of the text within the control.
However,
GetWindowTextLength(IntPtr) cannot retrieve the
length of the text of an edit control in another application.
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", CharSet = CharSet.Auto, SetLastError = true)]
public static int GetWindowTextLength(
IntPtr hWnd
)
<DllImportAttribute("User32.dll", CharSet := CharSet.Auto, SetLastError := true>]
Public Shared Function GetWindowTextLength (
hWnd As IntPtr
) As Integer
Dim hWnd As IntPtr
Dim returnValue As Integer
returnValue = User32.GetWindowTextLength(hWnd)
public:
[DllImportAttribute(L"User32.dll", CharSet = CharSet::Auto, SetLastError = true)]
static int GetWindowTextLength(
IntPtr hWnd
)
[<DllImportAttribute("User32.dll", CharSet = CharSet.Auto, SetLastError = true)>]
static member GetWindowTextLength :
hWnd : IntPtr -> int
No code example is currently available or this language may not be supported.
- hWnd IntPtr
-
A handle to the window or control.
Int32
If the function succeeds, the return value is the length, in characters, of the text.
Under certain conditions, this value may actually be greater than the length of the text.
If the window has no text, the return value is
.
To get extended error information, call
GetLastWin32Error.