从大型机类访问电子表格控件的方法 [英] way to access Spreadsheet control from mainframe class
问题描述
在我的MFC应用程序中,我放置了一个SpreadSheet控件,并且需要从我的视图类访问同一控件,我们如何才能访问同一控件,基本上我的应用程序是单文档模板",
我尝试访问控制CSpreadSheet m_Spread;
a)CFrameWnd * pFrm =(CFrameWnd *)(AfxGetApp()-> m_pMainWnd)
pFrm-> GetActiveView();
尽管我无法从下面的语句附加传播控制,但
m_PreView.SetHWndSpread(pFrm-> m_Spread.GetHWnd());下面给出的错误,
Hi,
In my MFC Application, I have placed a SpreadSheet control, and need to access the same control from my view class, how can we access the same, basically my application is Single Document Template,
I tried to access control, CSpreadSheet m_Spread;
a) CFrameWnd *pFrm = (CFrameWnd *) (AfxGetApp() -> m_pMainWnd)
pFrm->GetActiveView();
Though I could not attach the spread control from below statement,
m_PreView.SetHWndSpread(pFrm->m_Spread.GetHWnd()); errors given below,
Error 1 error C2039: 'm_Spread' : is not a member of 'CFrameWnd' e:\printformview_src\formviewprint\preview.cpp 69
Error 2 error C2228: left of '.GetHWnd' must have class/struct/union e:\printformview_src\formviewprint\preview.cpp 69
Error 3 error C2039: 'm_Spread' : is not a member of 'CFrameWnd' e:\printformview_src\formviewprint\preview.cpp 84
Error 4 error C2039: 'm_Spread' : is not a member of 'CWnd' e:\printformview_src\formviewprint\preview.cpp 103
但是,如果使用Dialog App,它会成功嵌入电子表格.
CPrintPreviewDlg * parentWnd =(CPrintPreviewDlg *)GetParent();
m_Preview.SetHwndSpread(parentWnd-> m_Spread.GetHwnd());没有错误.
我正在尝试将基于对话框的应用程序(电子表格)转换为基于SDI FormView的应用程序(电子表格).,
我正在使用VS2008 IDE,Windows 7 O/S,电子表格(Farpoint技术),使用FormView在我的Doc-View应用程序中具有基类.在此先感谢...
问候,
VishalK_92
However, it successfully embeds the Spreadsheet in case of Dialog App.,
CPrintPreviewDlg * parentWnd = (CPrintPreviewDlg *) GetParent();
m_Preview.SetHwndSpread(parentWnd->m_Spread.GetHwnd()); without errors.
I am trying to convert Dialog based App (Spreadsheet) to SDI FormView based App(Spreadsheet).,
I am using VS2008 IDE, Windows 7 O/S , Spreadsheet (Far point tech) using FormView has base class in my Doc-View app.Thanks in Advance...
With Regards,
VishalK_92
推荐答案
尝试一下(如果我理解正确的话)
Try this (if I understand correctly)
CView* pActiveView = ((CFrameWnd*)AfxGetMainWnd())->GetActiveView();
这篇关于从大型机类访问电子表格控件的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!