Solved

Creating a hidden window using CMultiDocTemplate

Posted on 2000-03-06
2
404 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 50 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to determine file rename from EventLog ? 2 49
maxBlock challenge 30 129
wait notify demo infinite loop 3 110
Way to decrease size of apk file 9 69
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

810 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