WinQueryWindowTextLength
Appearance
This call returns the length of the window text, excluding any null termination character.
Syntax
WinQueryWindowTextLength(hwnd);
Parameters
- hwnd (HWND) - input
- Window handle.
Returns
- lRetLen (LONG) - returns
- Length of the window text.
Remarks
This function sends a WM_QUERYWINDOWPARAMS message to hwnd.
Errors
Possible returns from WinGetLastError
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
Example Code
This example shows how to get the title-bar window text.
#define INCL_WINWINDOWMGR #define INCL_DOSMEMMGR #include <OS2.H> HWND hwndFrame; PSZ szTitle; ULONG cbBytes; cbBytes = WinQueryWindowTextLength(hwndFrame); DosAllocMem((PPVOID)szTitle, (ULONG)cbBytes, PAG_READ | PAG_WRITE | PAG_COMMIT); WinQueryWindowText(hwndFrame, sizeof(szTitle), szTitle);
Definition
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwnd; /* Window handle. */ LONG lRetLen; /* Length of the window text. */ lRetLen = WinQueryWindowTextLength(hwnd);
Related Functions
- WinQueryDlgItemShort
- WinQueryDlgItemText
- WinQueryDlgItemTextLength
- WinQueryWindowText
- WinSetDlgItemShort
- WinSetDlgItemText
- WinSetWindowText
Related Messages
- WM_QUERYWINDOWPARAMS