Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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,

VB
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




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
Posted
Comments
Sergey Alexandrovich Kryukov 11-Jul-12 11:02am    
What does it mean: "mainframe class"?
--SA
Richard MacCutchan 11-Jul-12 12:43pm    
The first error message could not really be clearer, you are trying to use a variable called m_Spread in your CFrameWnd class but you have not declared it within that class.

1 solution

Try this (if I understand correctly)

CView* pActiveView = ((CFrameWnd*)AfxGetMainWnd())->GetActiveView();
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900