在CView类中cpp文件命名一个全局变量,比如在#include“*.h”下面添加int test;然后在CFormView中.cpp文件添加extern int test;就可以给test赋值了。 改成独立的函数是什么意思,把代码贴出来