Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating a hidden window using CMultiDocTemplate

Posted on 2000-03-06
2
Medium Priority
?
424 Views
Last Modified: 2013-11-20
I want to create a document without displaying a new view or frame window.

I am able to create a new document and view at the same time using CMultiDocTemplate.  

How can I create a hidden window (with a document and without flashing or changing the active view)?
0
Comment
Question by:PeterKen
2 Comments
 
LVL 12

Accepted Solution

by:
migel earned 200 total points
ID: 2590753
Hmm
you can create document without view-frame by calling operator new.
but in this case you must provide public constructor for your document and also you must delete it manually (since MFC destroy doc when it`s frame has being destroyed).
Or you want create any docs based on the CMultiDocTemplate?
in this case you can use CreateNewDocument method of the CMultiDocTemplate

for example:
{
//look for needed template
CWinApp* pApp = AfxGetApp();
POSITION posTemplate = pApp->GetFirstDocTemplatePosition();
CDocTemplate* pTemplate = NULL;
while ((pTemplate = pApp-> GetNextDocTemplate( posTemplate) )!= NULL)
{
CDocument* pDocOpened = NULL;
if (pTemplate->MatchDocType(".docext", pDocOpened) != yesAttemptNative)
continue;
CDocument*  pDoc= pTemplate->CreateNewDocument();
}
}

here: ".docext" is extension of the document files you want to open. - see string  resource for document template
0
 

Author Comment

by:PeterKen
ID: 2592602
Thanks migel.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question