GetDlgItemText

Syntax

int GetDlgItemText(hDlg,nIDDlgItem,lpString,nMaxCount)

This function retrieves the caption or text associated with a control in a dialog box. The GetDlgItemText function copies the text to the location pointed to by the lpString parameter and returns a count of the number of characters it copies.

GetDlgItemText sends a WM_GETTEXT message to the control.

Parameter Type/Description  

hDlg HWND Identifies the dialog box that contains the control.  
nIDDlgItem int Specifies the integer identifier of the dialog-box item whose caption or text is to be retrieved.  
lpString LPSTR Points to the buffer to receive the text.  
nMaxCount int Specifies the maximum length (in bytes) of the string to be copied to lpString. If the string is longer than nMaxCount, it is truncated.  

Return Value

The return value specifies the actual number of characters copied to the buffer. It is zero if no text is copied.