Jump to content

WinQueryDlgItemText

From EDM2
Revision as of 23:44, 30 July 2023 by Martini (talk | contribs) (Created page with "This function queries a text string in a dialog item. ==Syntax== WinQueryDlgItemText(hwndDlg, idItem, lMaxText, pszText); ==Parameters== ;hwndDlg (HWND) - input :Parent-wi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function queries a text string in a dialog item.

Syntax

WinQueryDlgItemText(hwndDlg, idItem, lMaxText, pszText);

Parameters

hwndDlg (HWND) - input
Parent-window handle.
idItem (ULONG) - input
Identity of the child window whose text is to be queried.
It must be greater or equal to 0 and less or equal to 0xFFFF.
lMaxText (LONG) - input
Length of pszText.
It must be greater or equal to 0.
pszText (PSZ) - output
Output string.
This is the text string that is obtained from the dialog item.

Returns

ulRetLen (ULONG) - returns
Actual number of characters returned.
Error occurred
Other
Actual number of characters returned, not including the null-terminating character. The maximum value is (lMaxText-1).

Errors

Possible returns from WinGetLastError

PMERR_INVALID_HWND (0x1001)
An invalid window handle was specified.

Remarks

This function is valid for any window with children. However, it is typically used for dialog items in a dialog window.

Example Code

This example is the beginning of a function which processes the text which is displayed in the message text line.

#define INCL_WINDIALOGS
#include <OS2.H>
#define DID_MSGEDIT 900
void SelectMessageFromText(hwndDlg)
HWND    hwndDlg;
{
    char    szTemp[80];

    /* First get the edit text from the string */
    WinQueryDlgItemText(hwndDlg, DID_MSGEDIT, sizeof(szTemp),
            (PSZ)szTemp);
      /* . */
      /* . */
}
#define INCL_WINDIALOGS /* Or use INCL_WIN, INCL_PM, Also in COMMON section */
#include <os2.h>

HWND     hwndDlg;   /*  Parent-window handle. */
ULONG    idItem;    /*  Identity of the child window whose text is to be queried. */
LONG     lMaxText;  /*  Length of pszText. */
PSZ      pszText;   /*  Output string. */
ULONG    ulRetLen;  /*  Actual number of characters returned. */

ulRetLen = WinQueryDlgItemText(hwndDlg, idItem, lMaxText, pszText);

Related Functions

  • WinQueryDlgItemShort
  • WinQueryDlgItemText
  • WinQueryDlgItemTextLength
  • WinQueryWindowText
  • WinQueryWindowTextLength
  • WinSetDlgItemShort
  • WinSetDlgItemText
  • WinSetWindowText