谢谢mtsh,但是似乎有点问题: 我重载了OnOK(),如下 void InputDialog::OnOK() { // TODO: Add extra validation here
CDialog::OnOK(); //CChildView是我要更新的的视图类 ((CChildView*)(AfxGetApp()->GetActiveView()))->Invalidate();}但是编译报2个错~~ nputDialog.cpp ..\inputdialog.cpp(87) : error C2039: 'GetActiveView' : is not a member of 'CWinApp' f:\microsoft visual studio\vc98\mfc\include\afxwin.h(4031) : see declaration of 'CWinApp' ..\inputdialog.cpp(87) : error C2227: left of '->Invalidate' must point to class/struct/union Error executing cl.exe.
我重载了OnOK(),如下
void InputDialog::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
//CChildView是我要更新的的视图类
((CChildView*)(AfxGetApp()->GetActiveView()))->Invalidate();}但是编译报2个错~~
nputDialog.cpp
..\inputdialog.cpp(87) : error C2039: 'GetActiveView' : is not a member of 'CWinApp'
f:\microsoft visual studio\vc98\mfc\include\afxwin.h(4031) : see declaration of 'CWinApp'
..\inputdialog.cpp(87) : error C2227: left of '->Invalidate' must point to class/struct/union
Error executing cl.exe.
Invalidate();
((CChildView*)((CMainFrame*)AfxGetMainWnd())->GetActiveView))->Invalidate();(注意 #include "MainFrm.h")
((CChildView*)((CMainFrame*)AfxGetMainWnd())->GetActiveView()))->Invalidate();
Invalidate();
2。((CChildView*)((CMainFrame*)AfxGetMainWnd())->GetActiveView()))->Invalidate();
但是当我点击主窗口中弹出的对话框的“OK”时,VC++提示程序0XXXXXX20不可“read”
为什么呢?
1。if(dlg.DoModal()==IDOK)
Invalidate();
上面的代码是更新对话框的吧?
还是应该放在其它函数里??
if(dlg.DoModal()==IDOK)
Invalidate();