This function copies window text into a buffer.
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwnd; /* Window handle. */ LONG lLength; /* Length of pun. */ PUN pun; /* Window text. */ LONG lRetLen; /* Length of returned text not including the null terminator. */ lRetLen = WinQueryWindowText(hwnd, lLength, pun);