Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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

Syntax

UINT GetDlgItemText( 
  HWND 
hDlg, 
  int 
nIDDlgItem, 
  LPTSTR 
lpString, 
  int 
nMaxCount
); 

Parameters

hDlg

[in] Handle to the dialog box that contains the control.

nIDDlgItem

[in] Specifies the identifier of the control whose title or text is to be retrieved.

lpString

[out] Long pointer to the buffer to receive the title or text.

nMaxCount

[in] Specifies the maximum length, in characters, of the string to be copied to the buffer pointed to by lpString. If the length of the string exceeds the limit, the string is truncated.

Return Value

The number of characters copied to the buffer, not including the terminating null character, indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

The GetDlgItemTextfunction sends a WM_GETTEXT message to the control.

Requirements

Header winuser.h
Library Dlgmgr.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also