MFC中如何在 mainframe 中 用 cmyview 类(先答者得分)

来源:百度知道 编辑:UC知道 时间:2024/06/01 01:09:19
MFC中如何在 mainframe 中 用 cmyview 类
等待中
我在cmyview中定义了与一个控件关联的变量。我想通过菜单操纵这个控件。但是给菜单加载的事件处理函数在mainframe中。所以我就是想在mainframe中通过 cmyview * myview; myview->***来用这个控件。但是,编译的时候,系统提示:cmyview 是未声明的标识符。谢谢各位!

CButton b1;
b1.Create();

CButton b1;
RECT rc;
rc.top = 1;
rc.left = 1;
rc.bottom = 100;
rc.right = 100;
CWnd* pWnd = pDC->GetWindow();
b1.Create("ok", NULL, rc, pWnd, IDC_TEST_OK);
b1.MoveWindow(10, 10, 100, 100);
b1.ShowWindow(SW_SHOW);
b1.SetWindowText("why cant show");

能说下你的需求么,就是你要在mainframe中使用cmyview 类来干什么。

CView* pTmpView = GetActiveView();
这段代码可以在mainframe中获取View的指针,你通过这个指针看能不能操控View中的控件。