Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.


Windows Mobile 6.5
A version of this page is also available for

This function returns the identifier of the specified control.

int GetDlgCtrlID( 
  HWND hwndCtl


[in] Handle to the control.

The identifier of the control indicates success. Zero indicates failure. An invalid value for the hwndCtl parameter, for example, will cause the function to fail. To get extended error information, call GetLastError.

Identifiers are only valid for child windows. An application sets the identifier by passing it in as the hMenu parameter to the CreateWindowEx function. It can also be set and retrieved by calling the SetWindowLong and GetWindowLong functions with the nIndex parameter set to GWL_ID.

Although GetDlgCtrlID may return a value if hwndCtl identifies a top-level window, top-level windows cannot have identifiers and such a return value is never valid.

Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

© 2015 Microsoft