WinQueryWindowTextLength: Difference between revisions
Appearance
Created page with "This call returns the length of the window text, excluding any null termination character. ==Syntax== WinQueryWindowTextLength(hwnd); ==Parameters== ;hwnd (HWND) - input :W..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This call returns the length of the window text, excluding any null termination character. | This call returns the length of the window text, excluding any null termination character. | ||
==Syntax== | ==Syntax== | ||
WinQueryWindowTextLength(hwnd) | WinQueryWindowTextLength(hwnd) | ||
==Parameters== | ==Parameters== | ||
;hwnd (HWND) - input | ;hwnd (HWND) - input:Window handle. | ||
:Window handle. | |||
==Returns== | ==Returns== | ||
;lRetLen (LONG) - returns | ;lRetLen (LONG) - returns:Length of the window text. | ||
:Length of the window text. | |||
==Remarks== | ==Remarks== | ||
This function sends a WM_QUERYWINDOWPARAMS message to hwnd. | This function sends a WM_QUERYWINDOWPARAMS message to hwnd. | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
;PMERR_INVALID_HWND (0x1001) | ;PMERR_INVALID_HWND (0x1001):An invalid window handle was specified. | ||
:An invalid window handle was specified. | |||
==Example Code== | ==Example Code== | ||
This example shows how to get the title-bar window text. | This example shows how to get the title-bar window text. | ||
Line 23: | Line 22: | ||
#define INCL_WINWINDOWMGR | #define INCL_WINWINDOWMGR | ||
#define INCL_DOSMEMMGR | #define INCL_DOSMEMMGR | ||
#include < | #include <os2.h> | ||
HWND hwndFrame; | HWND hwndFrame; | ||
Line 38: | Line 37: | ||
WinQueryWindowText(hwndFrame, sizeof(szTitle), szTitle); | WinQueryWindowText(hwndFrame, sizeof(szTitle), szTitle); | ||
</pre> | </pre> | ||
Line 60: | Line 46: | ||
* [[WinSetDlgItemShort]] | * [[WinSetDlgItemShort]] | ||
* [[WinSetDlgItemText]] | * [[WinSetDlgItemText]] | ||
* [[WinSetWindowText ]] | * [[WinSetWindowText]] | ||
==Related Messages== | ==Related Messages== | ||
* WM_QUERYWINDOWPARAMS | * WM_QUERYWINDOWPARAMS | ||
[[Category:Win]] | [[Category:Win]] |
Latest revision as of 07:16, 7 August 2023
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);
Related Functions
- WinQueryDlgItemShort
- WinQueryDlgItemText
- WinQueryDlgItemTextLength
- WinQueryWindowText
- WinSetDlgItemShort
- WinSetDlgItemText
- WinSetWindowText
Related Messages
- WM_QUERYWINDOWPARAMS