Jump to content

WinQueryWindowTextLength

From EDM2
Revision as of 21:07, 6 August 2023 by Martini (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

Related Messages

  • WM_QUERYWINDOWPARAMS