15,886,873 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by cc.caprani (Top 3 by date)
cc.caprani
13-Apr-11 12:21pm
View
It didn't compile because the MyDoc.h wasn't included in the MyView.h file. I wasn't sure if cross-including them would lead to melt down so I hadn't before this. After including the View.h in MainFrame.cpp and MyDoc.h in MyView.h it compiles and the above code works. I can now handle the closing of the thread locally to the CView class. Of course I have other problems now....!!
Thanks for your help in solving this Joan!
cc.caprani
13-Apr-11 12:09pm
View
I tried this already, but maybe I did it wrong:
void CMainFrame::OnClose()
{
CMyView* pView = (CMyView*)((CFrameWnd*)AfxGetMainWnd())->GetActiveView();
ASSERT_VALID(pView);
pView->OnClose();
CFrameWnd::OnClose();
}
I include MyView.h in the top of the MainFrame.cpp file. It won't compile then though :(
Thanks again for your help!
cc.caprani
13-Apr-11 11:30am
View
Joan,
Thanks for replying. Can I be bold and ask two follow up questions to your solutions?!
1. Where should I handle the WM_CLOSE message so that it doesn't get called after the CDocument is already destroyed. I tried handling it from the CView class and it didn't work. If I try to handle it from CMainFrame then I need to access CView (where the threads lives) but I can't include MyView.h in MainFrame.h - tried it!
2. I'd like to process the interruption, but this is the essence of my problem - how do I do this? OnClose() in CView is too far down the terminating chain.
Thanks again for your help!