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

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


CreateNewFrame problem

Brijesh Kumar Mishra -- brijesh@aditya.pune.gssl.ernet.in
Monday, April 08, 1996

Platform : win 95
VC++ Ver : 4.0

	I am developing an application (MDI) that uses two different types
of child windows. One child window is having 3 splitter windows that are 
used to incorporate 4 different views. At some point I try to minimize this
kind of child window and invoke the other type of child window frame. This
frame is a normal MDI child window. My function for creation of this 
child window frame is something like this :

void CmDocument::InitializeResultMode(METHOD method, 
				CmBaseView* someView)
{

	CmApplication* app = GetApplication() ;	
	CmMainFrame* pMainFrame = (CmMainFrame* )app->m_pMainWnd ;

	CmChildFrame* frame = 
			(CmChildFrame*)someView->GetParent()
			->GetParent()->GetParent()->GetParent() ;
	frame->ShowWindow(SW_SHOWMINIMIZED) ;
	frame->EnableWindow(FALSE) ;

	pMainFrame->SetResultToolBar() ;

	pMainFrame->m_wndStatusBar.ShowWindow(SW_HIDE) ;
	if (pMainFrame->m_DlgBar)
		pMainFrame->m_DlgBar->ShowWindow(SW_HIDE) ;

	pMainFrame->m_wndGroupToolBar.ShowWindow(SW_HIDE) ;
	pMainFrame->m_wndObjectToolBar.ShowWindow(SW_HIDE) ;

	CFrameWnd* pNewFrame ;

	CmDocument* pDoc = this ;
/*
------	Application is maintaing two kinds of document templates
	One for the previous kind of child windows and the other for
	this new kind.
------	Problem is in this statement ----------
*/
	pNewFrame = app->pResultTemplate->CreateNewFrame(
					pDoc, 
					pMainFrame
		    ) ;

	if (pNewFrame == NULL) 
	{
	    AfxMessageBox("Faild for new Frame") ;
            return ;
	}
	
	app->pResultTemplate->InitialUpdateFrame(pNewFrame, pDoc) ;
}

	When this function is executed, CreateNewFrame() of the document
template returns NULL. I tried by overriding this function, LoadFrame(), 
and Create() for this child window of mine. But nothing seems to be working
I am unable to detect the reason why this is failing. The same code is
working with VC++ 2.1. 
	Is there any body, who can help me.

ThanX in advance,

- brij

-------------------------------------------------------------------------
	One can't change the past but one can ruin a perfectly good
	present by worrying about the future.

Brijesh Kumar Mishra
e-mail : brijeshm@gssl.ernet.in
-------------------------------------------------------------------------





Niels Ull Jacobsen -- nuj@kruger.dk
Wednesday, April 10, 1996

At 15:38 08-04-96 +0500, you wrote:
>Platform : win 95
>VC++ Ver : 4.0
>
>	I am developing an application (MDI) that uses two different types
>of child windows. One child window is having 3 splitter windows that are 
>used to incorporate 4 different views. At some point I try to minimize this
>kind of child window and invoke the other type of child window frame. This
>frame is a normal MDI child window. My function for creation of this 
>child window frame is something like this :
>
>void CmDocument::InitializeResultMode(METHOD method, 
>				CmBaseView* someView)
...
>	CmMainFrame* pMainFrame = (CmMainFrame* )app->m_pMainWnd ;
...
>	pNewFrame = app->pResultTemplate->CreateNewFrame(
>					pDoc, 
>					pMainFrame
>		    ) ;
...
[...]
>	When this function is executed, CreateNewFrame() of the document
>template returns NULL

Read up on CreateNewFrame(). I don't really think you want to use pMainFrame
as the second parameter - try NULL.

Niels Ull Jacobsen, Krьger A/S (nuj@kruger.dk)
Everything stated herein is THE OFFICIAL POLICY of the entire Kruger group
and should be taken as legally binding in every respect. Pigs will grow
wings and fly.









| Вернуться в корень Архива |