Jump to content

WinQueryDlgItemTextLength: Difference between revisions

From EDM2
Created page with "This function queries the length of the text string in a dialog item, not including any null termination character. WinQueryDlgItemTextLength(hwndDlg, idItem); ==Parameter..."
 
No edit summary
Line 1: Line 1:
This function queries the length of the text string in a dialog item, not including any null termination character.
This function queries the length of the text string in a dialog item, not including any null termination character.
 
==Syntax==
  WinQueryDlgItemTextLength(hwndDlg, idItem);  
  WinQueryDlgItemTextLength(hwndDlg, idItem);  


Line 66: Line 66:
lRetLen = WinQueryDlgItemTextLength(hwndDlg, idItem);
lRetLen = WinQueryDlgItemTextLength(hwndDlg, idItem);
</pre>
</pre>
==Related Functions==
* WinQueryDlgItemShort
* WinQueryDlgItemText
* WinQueryDlgItemTextLength
* WinQueryWindowText
* WinQueryWindowTextLength
* WinSetDlgItemShort
* WinSetDlgItemText
* WinSetWindowText


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

Revision as of 23:40, 30 July 2023

This function queries the length of the text string in a dialog item, not including any null termination character.

Syntax

WinQueryDlgItemTextLength(hwndDlg, idItem); 

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.

Returns

lRetLen (LONG) - returns
Length of text.
Error occurred
Other
Length of text.

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
#define INCL_DOSMEMMGR
#include <OS2.H>
#define DID_MSGEDIT 900
void SelectMessageFromText(hwndDlg)
HWND    hwndDlg;
{

char *szTemp;
LONG  length;

    /* First get the edit text from the string */

 length = WinQueryDlgItemTextLength(hwndDlg,
                                     DID_MSGEDIT);
   /* now we know the buffer size needed. */

DosAllocMem((PPVOID)szTemp,
            (ULONG)length,
             PAG_READ |
             PAG_WRITE |
             PAG_COMMIT);

 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     lRetLen;  /*  Length of text. */

lRetLen = WinQueryDlgItemTextLength(hwndDlg, idItem);

Related Functions

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