|
WindowHelperGetWindowText Method |
Copies the text of the specified window's title bar (if it has one) into a buffer. If the
specified window is a control, the text of the control is copied. However, GetWindowText
cannot retrieve the text of a control in another application.
GetWindowText function Namespace: Xcalibur.NativeMethods.V2.WindowsAssembly: Xcalibur.NativeMethods.V2 (in Xcalibur.NativeMethods.V2.dll) Version: 1.0.1.0
Syntax [DllImportAttribute("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static int GetWindowText(
IntPtr windowHandle,
StringBuilder buffer,
int maxCharCount
)
<DllImportAttribute("user32.dll", CharSet := CharSet.Auto, SetLastError := true>]
Public Shared Function GetWindowText (
windowHandle As IntPtr,
<OutAttribute> buffer As StringBuilder,
maxCharCount As Integer
) As Integer
public:
[DllImportAttribute(L"user32.dll", CharSet = CharSet::Auto, SetLastError = true)]
static int GetWindowText(
IntPtr windowHandle,
[OutAttribute] StringBuilder^ buffer,
int maxCharCount
)
[<DllImportAttribute("user32.dll", CharSet = CharSet.Auto, SetLastError = true)>]
static member GetWindowText :
windowHandle : IntPtr *
buffer : StringBuilder byref *
maxCharCount : int -> int
Parameters
- windowHandle IntPtr
- A handle to the window or control containing the text.
- buffer StringBuilder
- The buffer that will receive the text. If the string is as long or
longer than the buffer, the string is truncated and terminated with a null character.
- maxCharCount Int32
- The maximum number of characters to copy to the buffer,
including the null character. If the text exceeds this limit, it is truncated.
Return Value
Int32See Also