Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have an old MFC project in C++ on VS NET 2003 and I have the following issue.

My project is a SDI in which I put a SplitterWnd to have two views.
And I would like to detect view activation change to perform some activations/desactivations.

As it seems to correspond exactly to what I am looking for, I tried to inherit CFrameWnd::SetActiveView(CView* pViewNew, BOOL bNotify) in my CMainFrame (public derived from CFrameWnd) in public as follow:

in .h:
public:
void SetActiveView(CView* pViewNew, BOOL bNotify = TRUE);

in .cpp:
void CMainFrame::SetActiveView(CView* pViewNew, BOOL bNotify)
{
Beep (440, 200);
CFrameWnd::SetActiveView(pViewNew, bNotify);
}

And my function is never called; the CFrameWnd::SetActiveView() remains the one which is called.

Perhaps, there is a message handler or something else to add? or a specific limitation/incompatibility/bug?

It should be easy, but...

Thank you in advance for your help,
Eric

What I have tried:

Inherit CFrameWnd::SetActiveView()
Posted
Updated 25-Aug-18 23:05pm

1 solution

Looking at the documentation: CFrameWnd Class[^], this is not a virtual function, which means it is not overridable.
 
Share this answer
 
Comments
Member 13916604 27-Aug-18 5:38am    
Thank you Richard for your answer.
In this case, do you know a different way to be inform about view change of my splitter window?
Richard MacCutchan 27-Aug-18 5:51am    
Sorry no idea, it is a long time since I used MFC. You could try a Google search to see if anyone else has found a way, or if there is something in the CDocument class that can help.
Member 13916604 27-Aug-18 12:44pm    
To keep you in touch, I implemented OnActivateView in my view and sent a message to the mainframe.
I don't know if it is the smartest and cleanest solution, but... it works :)
Richard MacCutchan 27-Aug-18 15:05pm    
Well that is what is important. Good luck.

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