int get_window_text(handle window,
                    character* buffer,
                    int length)

This function obtains the text of a window.


handle window

The handle of the window whose text is being queried.

character* buffer

A pointer to a buffer to which the text is copied.

int length

The size of the buffer provided by the previous parameter. If the window's text exceeds this size, it is truncated.



The length (in characters) of the text that was copied to the buffer. If the specified window has no text, zero is returned. Zero is returned when an error occurs.


The text of a control from another process cannot be obtained through this function.

If the window is owned by the current process, the message message::get_text is sent to the window. If the window is owned by another process that has a caption, the window caption text is retrieved. If the window is of another process and does not have a caption, a null string is returned.