TextGRAB SDK Documentation | ITextGRABSDK::CaptureString

Captures string text from window at point.

HRESULT CaptureString(

INT_PTR hwnd,
INT x,
INT y,
BSTR* Value,
LONG* Index


[Visual Basic]

ByVal hwnd As INT_PTR,
ByVal x As Long,
ByVal y As Long,
ByRef Value As String,
ByRef Index As Long


void ITextGRABSDK.CaptureString(

INT_PTR hwnd,
int x,
int y,
ref string Value,
ref int Index



[in] target window handle.
[in] target x-coordinate.
[in] target y-coordinate.
[out] captured string.
[out] zero-based index of character in string which is under specified x-coordinate. Can be -1 in case if there are no characters under x-coordinate (e.g. if x is to the left of the first character of string or to the right of the last character)

Return Value(s)


Return Value(s) Definitions
S_OK (0x00000000) Operation was completed successfully.
E_FAIL (0x80004005) Error.
E_INVALIDARG (0x80070057) The hwnd parameter is not a valid window handle.
S_FALSE (0x00000001) The text string could not be captured. Empty string was returned.
E_POINTER (0x80004003) The retval or Index parameter is NULL.
FAILED(hr) Appropriate error message.

See Also

ITextGRABSDK interface