15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Removing Document Templates

peter.hodgman@autodesk.com
Saturday, February 08, 1997

     Environment: MSVC 4.0 Win NT 4.0
     
     During the execution of my MFC application I would like to remove a 
     document template from the CWinApp's CDocManager. The MFC CWinApp and 
     CDocManager classes have methods for Adding document templates but 
     none for removing them. Its clear that I could add this functionality 
     myself if I needed it. It is not clear if such additional 
     functionality has any bad side affects for MFC in general. It looks to 
     me that this should not be a problem if I ensure that the DocTemplate 
     that is being removed has no outstanding Documents or Views..Is this a 
     correct assuption or are there other issues that I need to be aware 
     of..
     
     Thanks in advance,
     
     Pete Hodgman




peter.hodgman@autodesk.com
Monday, February 10, 1997

     
     I must admit it is a little out of the normal to remove doc/view 
     templates. Here is my reason for doing so :
     
     The application I am building allows subsets of the application to be 
     dynamically loaded. The subsets are defined in MFC extension DLL's. In 
     some cases the subsets register doc/view templates. When I shutdown 
     the application I unload the dynamically loaded subsets that were 
     loaded during the user session. Just prior to unloading the DLL's the 
     DLL is asked to clean up for shutdown. If the DLL has registered 
     Doc/View templates I would like to remove them..


______________________________ Reply Separator _________________________________
Subject: Re: Removing Document Templates
Author:  mfc-l@netcom.com at smtpcc1
Date:    2/9/97 5:34 PM


At 03:44 2/8/97 PST, peter.hodgman@autodesk.com wrote: 
>     Environment: MSVC 4.0 Win NT 4.0
     
>     During the execution of my MFC application I would like to remove a 
>     document template from the CWinApp's CDocManager. The MFC CWinApp and 
>     CDocManager classes have methods for Adding document templates but 
>     none for removing them.
     
I'm curious: why do you wanna do this?
     
> Its clear that I could add this functionality 
>     myself if I needed it. It is not clear if such additional 
>     functionality has any bad side affects for MFC in general. It looks to 
>     me that this should not be a problem if I ensure that the DocTemplate 
>     that is being removed has no outstanding Documents or Views..Is this a 
>     correct assuption or are there other issues that I need to be aware 
>     of..
     
You have to gracefully shut down the template.  If the template is 
for an OLE-based document, it might have caused a class factory to register. 
Otherwise, it should be as straightforward as you speculate.
     
.B ekiM
     
     
.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
           This performance was not lip-synched.
     





Become an MFC-L member | Вернуться в корень Архива |