在编一个简单的对话筐的时候,首先添加对话筐资源;在设计对话筐;在用classwizard为对话筐派生一个类,名为CMyDlg;再添加用户代码,如”欢迎进入“:最后在程序中使用对话筐。
在其中我调入了先前建的一单文档应用项目EX_SDIHello.在程序中使用对话筐时。首先在EX_SDIhello.cpp开头加上:
#include "MyDlg.h"
然后在InitInstance函数体中的”return TRUE;"前加入了:
CMyDlg dlg;
dlg.DoModal; 然后编译,有如下四错:
D:\Program Files\Microsoft Visual Studio\EX_SDIHello\EX_SDIHello.cpp(94) : error C2065: 'dlg' : undeclared identifier
D:\Program Files\Microsoft Visual Studio\EX_SDIHello\EX_SDIHello.cpp(94) : error C2228: left of '.DoModal' must have class/struct/union type
D:\Program Files\Microsoft Visual Studio\EX_SDIHello\EX_SDIHello.cpp(95) : error C2065: 'CMyDlg' : undeclared identifier
D:\Program Files\Microsoft Visual Studio\EX_SDIHello\EX_SDIHello.cpp(95) : error C2146: syntax error : missing ';' before identifier 'dlg' 我刚学vc,不知道怎么解决,望大家帮助。谢了。
在其中我调入了先前建的一单文档应用项目EX_SDIHello.在程序中使用对话筐时。首先在EX_SDIhello.cpp开头加上:
#include "MyDlg.h"
然后在InitInstance函数体中的”return TRUE;"前加入了:
CMyDlg dlg;
dlg.DoModal; 然后编译,有如下四错:
D:\Program Files\Microsoft Visual Studio\EX_SDIHello\EX_SDIHello.cpp(94) : error C2065: 'dlg' : undeclared identifier
D:\Program Files\Microsoft Visual Studio\EX_SDIHello\EX_SDIHello.cpp(94) : error C2228: left of '.DoModal' must have class/struct/union type
D:\Program Files\Microsoft Visual Studio\EX_SDIHello\EX_SDIHello.cpp(95) : error C2065: 'CMyDlg' : undeclared identifier
D:\Program Files\Microsoft Visual Studio\EX_SDIHello\EX_SDIHello.cpp(95) : error C2146: syntax error : missing ';' before identifier 'dlg' 我刚学vc,不知道怎么解决,望大家帮助。谢了。
dlg.DoModal();
还有dlg.DoModal();的括号不要忘记加上!