GetDlgItemText

  UINT GetDlgItemText(hwndDlg, idControl, lpsz, cchMax)    
  HWND hwndDlg; /* handle of dialog box */
  int idControl; /* identifier of control */
  LPTSTR lpsz; /* address of buffer for text */
  int cchMax; /* maximum size of string */

The GetDlgItemText function retrieves the title or text associated with a control in a dialog box.

Parameters

hwndDlg

Identifies the dialog box that contains the control.

idControl

Specifies the integer identifier of the dialog-box item whose caption or text is to be retrieved.

lpsz

Points to the buffer to receive the text.

cchMax

Specifies the maximum length (in characters) of the string to be copied to lpsz. If the string is longer than cchMax, it is truncated.

Return Value

The return value specifies the number of characters copied to the buffer, not including the terminating null character, if the function is successful. Otherwise, it is zero.

Comments

The GetDlgItemText function sends a WM_GETTEXT message to the control.

The GetDlgItemText function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

SetDlgItemText, GetDlgItemInt, SetDlgItemInt