Jump to content

WinQueryDlgItemText: Difference between revisions

From EDM2
 
Line 49: Line 49:
* [[WinQueryDlgItemTextLength]]
* [[WinQueryDlgItemTextLength]]
* [[WinQueryWindowText]]
* [[WinQueryWindowText]]
* WinQueryWindowTextLength
* [[WinQueryWindowTextLength]]
* WinSetDlgItemShort
* [[WinSetDlgItemShort]]
* WinSetDlgItemText
* [[WinSetDlgItemText]]
* WinSetWindowText  
* [[WinSetWindowText]]


[[Category:Win]]
[[Category:Win]]

Latest revision as of 21:16, 6 August 2023

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);
      /* . */
      /* . */
}

Related Functions