读书人

请教在单文档框架中在APP中调用view窗

发布时间: 2012-02-11 09:51:34 作者: rapoo

请问在单文档框架中在APP中调用view窗口的函数的方法
一、view类好像不能直接实例话一个对象出来,例如:CView m_view; 不知道为什么... 有什么解决办法么?

再有就是用指针 CView* pView; 可是这样编译不会报错,但执行会报错。。。

第三种方式:

int CVTPLAYERApp::Run()
{
MSG msg;

while(1) {
if(PeekMessage(&msg, NULL,0,0,PM_REMOVE)) {
if(msg.message==WM_QUIT) {
return CWinApp::Run();
}
else if(!TranslateAccelerator(msg.hwnd,m_hAccelTable,&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
else {

// process the player

if(!CVTPLAYERView::Instance().Process(m_Config))
{
PostQuitMessage(0);
return CWinApp::Run();
}
}

}

return msg.wParam;
}


process是执行函数应该没有什么问题

在view类的instance()当中;


CVTPLAYERView& CVTPLAYERView::Instance()
{
if (thePlayer==0) {
thePlayer = new CVTPLAYERView();
}
return *thePlayer;
}

以上三种方式都不行,请问还有什么解决办法



[解决办法]
GetViewCtrl
得到视图控件指针

读书人网 >VC/MFC

热点推荐