Export (0) Print
Expand All

GetDlgItem

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function retrieves the handle to a control in the specified dialog box.


HWND GetDlgItem( 
  HWND hDlg, 
  int nIDDlgItem
); 

hDlg

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

nIDDlgItem

[in] Specifies the identifier of the control to be retrieved.

The window handle of the specified control indicates success. NULL indicates failure due to an invalid dialog box handle or a nonexistent control. To get extended error information, call GetLastError.

You can use the GetDlgItem function with any parent-child window pair, not just with dialog boxes. As long as the hDlg parameter specifies a parent window and the child window has a unique identifier (as specified by the hMenu parameter in the CreateWindow or CreateWindowEx function that created the child window), GetDlgItem returns a valid handle to the child window.

The GetDlgItem function works for immediate child controls of a dialog box — it does not search through nested dialog boxes.

Headerwinuser.h
LibraryDlgmgr.lib
Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

ADD
Show:
© 2014 Microsoft