Compartir a través de


CWnd::GetDlgItem

Retrieves a pointer to the specified control or child window in a dialog box or other window.

CWnd* GetDlgItem(
   int nID 
) const;
void GetDlgItem(
   int nID,
   HWND* phWnd
) const;

Parameters

  • nID
    Specifies the identifier of the control or child window to be retrieved.

  • phWnd
    A pointer to a child window.

Return Value

A pointer to the given control or child window. If no control with the integer ID given by the nID parameter exists, the value is NULL.

The returned pointer may be temporary and should not be stored for later use.

Remarks

The pointer returned is usually cast to the type of control identified by nID.

Example

// uses GetDlgItem to return a pointer to a user interface control
CEdit* pBoxOne;
pBoxOne = (CEdit*)GetDlgItem(IDC_MYEDIT);
GotoDlgCtrl(pBoxOne);

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CWnd::GetWindow

CWnd::GetDescendantWindow

CWnd::GetWindow

GetDlgItem

Concepts

CWnd Members