Click here to Skip to main content
16,006,065 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am working on MFC Visual Studio MutliTab interface.

On application start, the visual studio provides us one default view tab.

I want to prevent this tab being created..

for this, what i tried..

C++
BOOL CProjectManagerView::PreCreateWindow(CREATESTRUCT& cs)
{
	return CView::PreCreateWindow(cs);
}


i commeted
C++
return CView::PreCreateWindow(cs);

and returned FALSE

But on run, it displays message, "Failed to create empty document"

So, i want to know..

what are the steps to prevent it from creating an default empty tab?
Posted
Updated 31-May-12 17:10pm
v2

1 solution

In your main app file, find "InitInstance".
There, find a place where it says somomething like:

C#
CMultiDocTemplate* pDocTemplate;
    pDocTemplate = new CMultiDocTemplate(IDR_MyTYPE,
        RUNTIME_CLASS(CMyDoc),
        RUNTIME_CLASS(CChildFrame), // custom MDI child frame
        RUNTIME_CLASS(CMyView));
    if (!pDocTemplate)
        return FALSE;
    AddDocTemplate(pDocTemplate);


Comment that not to create a default tab.

Hope it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900