HWND GetDlgItem(hwndDlg, idControl) | |||||
HWND hwndDlg; | /* handle of dialog box | */ | |||
int idControl; | /* identifier of control | */ |
The GetDlgItem function retrieves the handle of a control that is in the given dialog box.
hwndDlg
Identifies the dialog box that contains the control.
idControl
Specifies the identifier of the control to be retrieved.
The return value is the handle of the given control if the function is successful. Otherwise, it is NULL, indicating either an invalid dialog box handle or a nonexistent control.
The GetDlgItem function can be used with any parent-child window pair, not just dialog boxes. As long as the hwndDlg parameter identifies a parent window and the child window has a unique identifier (as specified by the hmenu parameter in the CreateWindow function that created the child window), GetDlgItem returns the handle of the child window.
CreateWindow, GetDlgCtrlID, GetDlgItemInt, GetDlgItemText, GetWindow