Click here to Skip to main content
16,017,899 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to use sqlexec Pin
prithaa25-Nov-07 18:31
prithaa25-Nov-07 18:31 
GeneralRe: how to use sqlexec Pin
Mark Salsbery25-Nov-07 18:52
Mark Salsbery25-Nov-07 18:52 
AnswerRe: how to use sqlexec Pin
David Crow26-Nov-07 3:55
David Crow26-Nov-07 3:55 
Questionhow to close a form? Pin
panthal24-Nov-07 20:17
panthal24-Nov-07 20:17 
AnswerRe: how to close a form? Pin
Hamid_RT24-Nov-07 23:07
Hamid_RT24-Nov-07 23:07 
GeneralRe: how to close a form? Pin
panthal24-Nov-07 23:13
panthal24-Nov-07 23:13 
GeneralRe: how to close a form? Pin
Hamid_RT25-Nov-07 2:46
Hamid_RT25-Nov-07 2:46 
AnswerRe: how to close a form? Pin
Nelek25-Nov-07 21:52
protectorNelek25-Nov-07 21:52 
There is more than a solution. I make it like this.

void CMainFrame::CloseMyFrame ()
{	//Get necessary connections
	CMDIChildWnd* pMDIActive = MDIGetActive();
	CDocument* pDoc = pMDIActive->GetActiveDocument();
	CMyView* pMyView;

	POSITION pos = pDoc->GetFirstViewPosition();
	while (pos)
	{	pMyView = (CMyView*) pDoc->GetNextView(pos);
		if (pMyView->IsKindOf(RUNTIME_CLASS(CMyView)))
		{	CFrameWnd* pTempFrame = pMyView->GetParentFrame ();
			pTempFrame->DestroyWindow ();
			return;
		}
	}
	return;
}


And, when I want to use it...

extern CFPSApp theApp;
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
pFrame->CloseMyFrame ();


I forgot...
I make it to close a specific Frame (that may be only ONCE at a time)

For other that I may be more times at once opened, I like follows
void CMainFrame::CloseMyFrame (CString szName)
//....
if ((pMyView->IsKindOf(RUNTIME_CLASS(CMyOtherView))) && (pMyView->m_pParent->m_szName == szName))
//...


This is because I use that views to modifify the parameters of an element. So I hold a pointer to the element that is being shown as a member variable in every window. So I get easy access to the data I have to show/modify and use it to differenciate between the 48 possible CFormViews that can be opened at once.

Greetings.

--------
M.D.V. Wink | ;)

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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

QuestionRoate image using dragging [modified] Pin
followait24-Nov-07 18:58
followait24-Nov-07 18:58 
QuestionDialog death Pin
Oliver12324-Nov-07 18:58
Oliver12324-Nov-07 18:58 
AnswerRe: Dialog death Pin
Gary R. Wheeler25-Nov-07 4:15
Gary R. Wheeler25-Nov-07 4:15 
AnswerRe: Dialog death Pin
ThatsAlok25-Nov-07 20:17
ThatsAlok25-Nov-07 20:17 
GeneralRe: Dialog death Pin
Florin Crişan25-Nov-07 21:30
Florin Crişan25-Nov-07 21:30 
Questionhow can i get OS hardware info Pin
lgbean24-Nov-07 16:39
lgbean24-Nov-07 16:39 
QuestionRe: how can i get OS hardware info Pin
David Crow24-Nov-07 17:20
David Crow24-Nov-07 17:20 
AnswerRe: how can i get OS hardware info Pin
Gary R. Wheeler25-Nov-07 4:17
Gary R. Wheeler25-Nov-07 4:17 
GeneralRe: how can i get OS hardware info Pin
Hamid_RT25-Nov-07 7:12
Hamid_RT25-Nov-07 7:12 
GeneralRe: how can i get OS hardware info Pin
David Crow25-Nov-07 9:49
David Crow25-Nov-07 9:49 
AnswerRe: how can i get OS hardware info Pin
Hamid_RT24-Nov-07 20:06
Hamid_RT24-Nov-07 20:06 
QuestionOne CFrameWnd with two CView, How to implement? [modified] Pin
followait24-Nov-07 16:27
followait24-Nov-07 16:27 
AnswerRe: One CFrameWnd with two CView, How to implement? Pin
Nelek25-Nov-07 21:47
protectorNelek25-Nov-07 21:47 
GeneralRe: One CFrameWnd with two CView, How to implement? Pin
followait25-Nov-07 22:09
followait25-Nov-07 22:09 
AnswerRe: One CFrameWnd with two CView, How to implement? Pin
JudyL_MD26-Nov-07 3:06
JudyL_MD26-Nov-07 3:06 
GeneralRe: One CFrameWnd with two CView, How to implement? Pin
followait26-Nov-07 3:34
followait26-Nov-07 3:34 
GeneralRe: One CFrameWnd with two CView, How to implement? Pin
JudyL_MD26-Nov-07 3:44
JudyL_MD26-Nov-07 3:44 

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.