CGetcwndDlg* pApp=(CGetcwndDlg *) AfxGetApp(); CWnd * pMainWnd=(CWnd *)pApp->m_hWnd; CString strText=_T(""); strText.Format("pMainWnd=0x%X/nthis=0x%X/n",pMainWnd,this); AfxMessageBox(strText);