GetDlgItemTextA function (winuser.h)
Retrieves the title or text associated with a control in a dialog box.
UINT GetDlgItemTextA( [in] HWND hDlg, [in] int nIDDlgItem, [out] LPSTR lpString, [in] int cchMax );
A handle to the dialog box that contains the control.
The identifier of the control whose title or text is to be retrieved.
The buffer to receive the title or text.
The maximum length, in characters, of the string to be copied to the buffer pointed to by lpString. If the length of the string, including the null character, exceeds the limit, the string is truncated.
If the function succeeds, the return value specifies the number of characters copied to the buffer, not including the terminating null character.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the string is as long or longer than the buffer, the buffer will contain the truncated string with a terminating null character.
The GetDlgItemText function sends a WM_GETTEXT message to the control.
For an example, see Creating a Modal Dialog Box.
The winuser.h header defines GetDlgItemText as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||winuser.h (include Windows.h)|
|API set||ext-ms-win-ntuser-dialogbox-l1-1-0 (introduced in Windows 8)|