Click here to Skip to main content
16,016,962 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: what is wrong in this code Pin
Stephen Hewitt15-May-07 22:03
Stephen Hewitt15-May-07 22:03 
AnswerRe: what is wrong in this code Pin
krmed16-May-07 1:56
krmed16-May-07 1:56 
QuestionHow to check if a valid document file is loaded in mfc Pin
TariqZ15-May-07 19:58
TariqZ15-May-07 19:58 
QuestionRe: How to check if a valid document file is loaded in mfc Pin
Nelek15-May-07 22:00
protectorNelek15-May-07 22:00 
Questionhow to combine to dialog boxes and a formview in a single application .. Pin
mirraa15-May-07 19:27
mirraa15-May-07 19:27 
AnswerRe: how to combine to dialog boxes and a formview in a single application .. Pin
Nelek15-May-07 21:57
protectorNelek15-May-07 21:57 
GeneralRe: how to combine to dialog boxes and a formview in a single application .. Pin
mirraa16-May-07 1:11
mirraa16-May-07 1:11 
GeneralRe: how to combine to dialog boxes and a formview in a single application .. Pin
Nelek16-May-07 1:30
protectorNelek16-May-07 1:30 
Hi mirraa,

actually you can close all the opened windows/dialogs in one touch. For example, in my app (MDI in VC++ 6) I have one CScrollView as MainView and up to 48 CFormViews for each element I want to introduce its parameters. When I close one SecondaryView I close it, and when I close the MainView I close ALL the others. I do this with:
BOOL CMyDoc::CanCloseFrame(CFrameWnd* pFrame) 
{	int nError = 0;
	//With this I separate between added Views from MainView and close it when match
	CView* pFrmView = pFrame->GetActiveView ();
	if (pFrmView->IsKindOf (RUNTIME_CLASS (CFormView)))
		return TRUE;
	//If I’m trying to close the main, I close all the others before
	POSITION pos = GetFirstViewPosition ();
	while (pos)
	{	CView* pView = GetNextView (pos);
		if (pView->IsKindOf (RUNTIME_CLASS (CFormView)))
		{	CFrameWnd* pTempFrame = pView->GetParentFrame ();
			if (pTempFrame)
				pTempFrame->DestroyWindow ();
		}
	}
	
	return CDocument::CanCloseFrame(pFrame);
}


The only difference with the DialogBoxes is that you don't have this list for opened Views in Document. But you can also made it by yourself. Just create a CWnd* dlgArray [MAX] or hWnd dlgArray [MAX] and, in every DialogBox, take a pointer (or a handle, whatever you like more) to the opened DialogBox in the OnInitDialog. Afterwards you can close them as well with a call to DestroyWindow, CloseDialog or other functions like those.

Greetings.

--------
M.D.V.

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

GeneralRe: how to combine to dialog boxes and a formview in a single application .. Pin
mirraa18-May-07 20:43
mirraa18-May-07 20:43 
GeneralRe: how to combine to dialog boxes and a formview in a single application .. Pin
Nelek19-May-07 23:02
protectorNelek19-May-07 23:02 
QuestionHow to use debugger Pin
Jerry Burns15-May-07 17:23
Jerry Burns15-May-07 17:23 
AnswerRe: How to use debugger Pin
_AnsHUMAN_ 15-May-07 18:01
_AnsHUMAN_ 15-May-07 18:01 
AnswerRe: How to use debugger Pin
Hamid_RT15-May-07 19:35
Hamid_RT15-May-07 19:35 
Questionlarge numbers Pin
locoone15-May-07 17:00
locoone15-May-07 17:00 
AnswerRe: large numbers Pin
Naveen15-May-07 17:45
Naveen15-May-07 17:45 
GeneralRe: large numbers Pin
locoone16-May-07 17:12
locoone16-May-07 17:12 
AnswerRe: large numbers Pin
Nelek15-May-07 21:53
protectorNelek15-May-07 21:53 
GeneralRe: large numbers Pin
locoone16-May-07 17:14
locoone16-May-07 17:14 
GeneralRe: large numbers Pin
Nelek19-May-07 23:03
protectorNelek19-May-07 23:03 
QuestionDebug vs Release Configuration Pin
Oliver12315-May-07 16:31
Oliver12315-May-07 16:31 
AnswerRe: Debug vs Release Configuration Pin
David Crow15-May-07 17:09
David Crow15-May-07 17:09 
GeneralRe: Debug vs Release Configuration Pin
Oliver12315-May-07 17:28
Oliver12315-May-07 17:28 
GeneralRe: Debug vs Release Configuration Pin
_AnsHUMAN_ 15-May-07 17:45
_AnsHUMAN_ 15-May-07 17:45 
GeneralRe: Debug vs Release Configuration Pin
dharani15-May-07 18:10
dharani15-May-07 18:10 
QuestionNeed help with Keyboard device drivers Pin
Willian Tell15-May-07 15:06
Willian Tell15-May-07 15:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.