The GetDlgItem function retrieves a handle to a control in the specified dialog box.
Syntax
Parameters
-
hDlg [in]
- HWND
-
Handle to the dialog box that contains the control.
nIDDlgItem [in]
- int
-
Specifies the identifier of the control to be retrieved.
Return Value
HWND
If the function succeeds, the return value is the window handle of the specified control.
If the function fails, the return value is NULL, indicating an invalid dialog box handle or a nonexistent control. To get extended error information, call GetLastError.
例子:
GetDlgItem(IDC_STATIC_CurveColor1)->GetClientRect(&CurveColor1);
this->ScreenToClient(&CurveColor1);
this->ClientToScreen(&CurveColor1);
CStatic *CS_shili1=(CStatic*)GetDlgItem(IDC_STATIC_CurveColor1);
CDC *pDC_shili1=(CDC*)CS_shili1->GetWindowDC();