GetText method

Available for Window, MDIWindow, DialogBox, Static, Edit, Group, Button, Check, and Radio objects.


GetText Proto hWnd:HWND, lpszBuffer:LPSTR


Invoke GetText, hWnd, lpszBuffer


Gets the Text property for an object.



Handle to the object.


Pointer to a buffer to receive the text for the object.

Return value

Eax returns the length, in characters, for the text of the object.

: For Window, MDIWindow and DialogBox objects this method copies the text of its caption (title bar) to the specified buffer, while for control objects it copies the text shown in the client area of the control. The buffer pointed by lpszBuffer must be large enough to contain the text of the object (max. 256 characters).

REMARKS: The GetText method fills lpszBuffer with a Unicode string if the application is running as Unicode, or with an ANSI string if not (see the IsAppUnicode method). You can call GetTextA to get the ANSI text in Unicode applications, or GetTextW to get the Unicode text in ANSI applications.