Jump to content

WinQueryWindowTextLength

From EDM2
Revision as of 07:16, 7 August 2023 by Ak120 (talk | contribs)
(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);

Related Functions

Related Messages

  • WM_QUERYWINDOWPARAMS