Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Differentiate Windows Pin
Ista1-Aug-05 10:50
Ista1-Aug-05 10:50 
GeneralRe: Differentiate Windows Pin
WoutL1-Aug-05 10:55
WoutL1-Aug-05 10:55 
GeneralRe: Differentiate Windows Pin
David Crow1-Aug-05 11:17
David Crow1-Aug-05 11:17 
GeneralRe: Differentiate Windows Pin
Ista1-Aug-05 11:50
Ista1-Aug-05 11:50 
GeneralRe: Differentiate Windows Pin
Ista1-Aug-05 13:41
Ista1-Aug-05 13:41 
GeneralRe: Differentiate Windows Pin
David Crow2-Aug-05 3:44
David Crow2-Aug-05 3:44 
GeneralCDocument::m_bAutoDelete question ( undocumented ) Pin
Maximilien1-Aug-05 8:54
Maximilien1-Aug-05 8:54 
GeneralRe: CDocument::m_bAutoDelete question ( undocumented ) Pin
Tom Archer1-Aug-05 10:58
Tom Archer1-Aug-05 10:58 
This goes back *years*, but...

Back in 1995 when I was at Peachtree we had a similar situation where the document represented the company whose accounting you were doing and each view was based on that document. Therefore, closing the last view didn't close the document/file. (The user either closed the company explicitly or via closing the app)

As you mentioned, setting the m_bAutoDelete member var in a CDocument-derived class does the trick.

Obviously, the framework has to shut down the menu as it's associated with the view/frame in the template.

Therefore, what we did was to share the menu across all views. IOW, we had a menu (named something like IDR_COMPANY_OPEN) that was always displayed when a cmopany was open regardless of how many views were open.

However, the trick is that when constructing templates, you have to specify a res id that among other things identifies the menu. However, we only wanted to share the menu across all views - not anything else. Therefore, we did the following (I'll try and explain it from 10 years of memory.

* In the app object's InitInstance, we manually loaded a menu and stored its handle
* We derived our own CMultiDocTemplate class
* When constructing each template, we passed the menu handle to that c'tor
* The CMultiDocTemplate-derived class's c'tor then set its internal menu handle to that passed
* [IMPORTANT] In the d'tor you have to set the handle to null. Otherwise, the base class's d'tor will attempt to destroy your shared menu.

I'm pretty sure that was all we had to do.

Tom Archer - Visual C++ MVP
Archer Consulting Group.com
GeneralRe: CDocument::m_bAutoDelete question ( undocumented ) Pin
Tom Archer1-Aug-05 11:02
Tom Archer1-Aug-05 11:02 
GeneralRe: CDocument::m_bAutoDelete question ( undocumented ) Pin
Maximilien1-Aug-05 12:49
Maximilien1-Aug-05 12:49 
GeneralRe: CDocument::m_bAutoDelete question ( undocumented ) Pin
Jose Lamas Rios1-Aug-05 17:21
Jose Lamas Rios1-Aug-05 17:21 
GeneralWTL Text Printing Pin
HumanOsc1-Aug-05 8:04
HumanOsc1-Aug-05 8:04 
GeneralRe: WTL Text Printing Pin
HumanOsc1-Aug-05 22:15
HumanOsc1-Aug-05 22:15 
GeneralMFC CFormView and CDoc Pin
Dosin1-Aug-05 6:58
Dosin1-Aug-05 6:58 
GeneralRe: MFC CFormView and CDoc Pin
Chris Losinger1-Aug-05 7:16
professionalChris Losinger1-Aug-05 7:16 
GeneralRe: MFC CFormView and CDoc Pin
Dosin1-Aug-05 7:37
Dosin1-Aug-05 7:37 
GeneralRe: MFC CFormView and CDoc Pin
Chris Losinger1-Aug-05 7:43
professionalChris Losinger1-Aug-05 7:43 
GeneralRe: MFC CFormView and CDoc Pin
Alex_Y1-Aug-05 7:44
Alex_Y1-Aug-05 7:44 
GeneralRe: MFC CFormView and CDoc Pin
Alex_Y1-Aug-05 7:46
Alex_Y1-Aug-05 7:46 
GeneralRe: MFC CFormView and CDoc Pin
Dosin1-Aug-05 8:25
Dosin1-Aug-05 8:25 
GeneralClass wizard Pin
BicycleTheif1-Aug-05 5:40
BicycleTheif1-Aug-05 5:40 
GeneralRe: Class wizard Pin
RChin1-Aug-05 5:46
RChin1-Aug-05 5:46 
GeneralRe: Class wizard Pin
BicycleTheif1-Aug-05 5:49
BicycleTheif1-Aug-05 5:49 
GeneralRe: Class wizard Pin
RChin1-Aug-05 5:53
RChin1-Aug-05 5:53 
GeneralSmart Pointer Pin
LCI1-Aug-05 5:34
LCI1-Aug-05 5:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.