1.CWnd
对于基于CWnd的类,如对话框
比如CXXXDialog
在对话框内部那就是
(CWnd*)this ;
如果定义的
CXXXDialog dlg ;
就是 (CWnd*)&dlg ;
如果是对话框的控件如IDC_EDIT1
CWnd *pEdit = GetDlgItem( IDC_EDIT1 ) ;
2.HWND
例如:
在CFormView或者CDialog内部:
HWND hWnd = GetSafeHwnd();
否则:
CFormView *pView = ......;
HWND hWndFormView = pView->GetSafeHwnd();
CDialog *pDlg = ......
HWND hWndDlg = pDlg->GetSafeHwnd();