![]() |
【转帖】有关保存全局数据的问题 王老师能不能给讲讲 docdata类的作用?
有关保存全局数据的问题 王老师能不能给讲讲 docdata类的作用?
有关保存全局数据的问题 王老师能不能给讲讲 docdata类的作用? // stdarx.h : include file for objectarx/dbx include files extern asdkdatamanager<cdocdata> docvars; #define mydlginfo docvars.docdata(); 在docdata.h中定义了几个字符串变量 class cdocdata { public: cdocdata(); cdocdata(const cdocdata &data) ; ~cdocdata(); // note: do not edit the following lines. //{{afx_arx_data(cdocdata) //}}afx_arx_data // todo: here you can add your variables // which depends on a document / database. cstring m_strdown; cstring m_strleft; cstring m_strright; cstring m_strup; }; 在docdata.cpp中将几个字符串变量并初始化为空 cdocdata::cdocdata(const cdocdata &data) { // todo: add your own initialization. m_strdown=""; m_strleft=""; m_strright=""; m_strup=""; } 在自己的对话框实现文件中想将输入到对话框的结果保存到全局中, void mydlg1::onok() { // todo: add extra validation here if (!updatedata(true)) { return; } //把结果保存到全局 mydlginfo.m_strdown=m_strdown; mydlginfo.m_strup=m_strup; mydlginfo.m_left=m_left; mydlginfo.m_right=m_right; cacuidialog::onok(); } 但是编译的时候出现了 compiling stl header files in release mode. o:\arx学习\mdialog\mydlg1.cpp(98) : error c2143: syntax error : missing ';' before '.' o:\arx学习\mdialog\mydlg1.cpp(99) : error c2143: syntax error : missing ';' before '.' o:\arx学习\mdialog\mydlg1.cpp(100) : error c2143: syntax error : missing ';' before '.' o:\arx学习\mdialog\mydlg1.cpp(101) : error c2143: syntax error : missing ';' before '.' 怎么会出现这样的错误呢??想不明白? 全局数据不用声明在docdata类中,声明在外部就可以,至于docdata有什么特殊的用途,我也不知道,sdk中的例子也没找到关于它的具体应用,如果是编译不通过,可以把你的整个工程发上来,我调试看一下 change your life style. reply 例子: change your life style. |
所有的时间均为北京时间。 现在的时间是 04:35 AM. |