GetDlgItem函数 返回某个控件的的句柄。

来源:互联网 发布:淘宝查虚假交易时间 编辑:程序博客网 时间:2024/06/05 13:28

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

Syntax

以带有颜色区分的格式查看复制到剪贴板打印
HWND GetDlgItem(  __in  HWND hDlg,  __in  int nIDDlgItem);

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();