Click here to Skip to main content
15,890,690 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Saving function pointers in Map Pin
Abhi Lahare29-Dec-09 4:58
Abhi Lahare29-Dec-09 4:58 
QuestionAnyway to stop a CView from being closed? Pin
Paul Belikian29-Dec-09 3:25
Paul Belikian29-Dec-09 3:25 
AnswerRe: Anyway to stop a CView from being closed? Pin
David Crow29-Dec-09 3:31
David Crow29-Dec-09 3:31 
GeneralRe: Anyway to stop a CView from being closed? Pin
Paul Belikian29-Dec-09 4:14
Paul Belikian29-Dec-09 4:14 
QuestionRe: Anyway to stop a CView from being closed? Pin
David Crow29-Dec-09 4:21
David Crow29-Dec-09 4:21 
AnswerRe: Anyway to stop a CView from being closed? Pin
Paul Belikian29-Dec-09 6:08
Paul Belikian29-Dec-09 6:08 
GeneralRe: Anyway to stop a CView from being closed? Pin
JudyL_MD29-Dec-09 16:50
JudyL_MD29-Dec-09 16:50 
GeneralRe: Anyway to stop a CView from being closed? Pin
Paul Belikian29-Dec-09 17:37
Paul Belikian29-Dec-09 17:37 
Hello Judy, yes, thank you for the suggestion. I actually did go that route using the DocTemplate to find all the views that I needed to check before closing. I chose this method because I also have multiple types of documents in the app - here is the code: forgive the mess, I'm self-taught Blush | :O

void CMainFrame::OnClose()
{
#ifdef _USE_CMC6INVOICE_THREAD_
	
	POSITION pos, posView;
		
	pos = theApp.m_pCmc6InvoiceDocTemplate->GetFirstDocPosition();
	while(pos != NULL)
	{
		CDocument *pDoc = theApp.m_pCmc6InvoiceDocTemplate->GetNextDoc(pos);
		if(pDoc!= NULL)
		{
			posView = pDoc->GetFirstViewPosition();
			while(posView != NULL)
			{
				CView * pView = pDoc->GetNextView(posView);
				if(pView->IsKindOf(RUNTIME_CLASS(CCMC6InvoiceView)))
				{
					CCMC6InvoiceView * pInv = (CCMC6InvoiceView *) pView;
					if(pInv->m_clsInvoice->m_pThread != NULL)
					{
						if(pInv->m_clsInvoice->m_pThread->GetActivityStatus() == THREAD_NOTPREPARED_TO_TERMINATE) 
						{
							TRACE("Mainframe: OnClose() ->CMC6InvoiceView Thread Busy, Can't close yet...\n");
							Sleep(200);
							PostMessage(WM_CLOSE); 
							return;
						}
					}
				}
			}
		}
	}
#endif
#ifdef _USE_BACKGROUND_THREAD_
	DWORD dwExitCode;
	m_pBackThread->Stop(dwExitCode, 0);
	if(m_pBackThread->GetActivityStatus() == THREAD_NOTPREPARED_TO_TERMINATE) 
	{
		TRACE("Mainframe: OnClose() ->BackProcess Thread Busy, Can't close yet...\n");
		Sleep(200);
		PostMessage(WM_CLOSE); 
	}
	else 
	{ 
		TRACE("Mainframe: OnClose() ->Can close now\n");
		m_pBackThread->Stop(dwExitCode);
		
		// Save the current state for tool bars and menus.
		SaveCommandBars(_T("CommandBars"));
		// Save the current state for docking panes.
		CXTPDockingPaneLayout layoutNormal(&m_paneManager);
		m_paneManager.GetLayout(&layoutNormal);
		layoutNormal.Save(_T("NormalLayout"));
		
		CMDIFrameWnd::OnClose();
   }
#else
	// Save the current state for tool bars and menus.
	SaveCommandBars(_T("CommandBars"));
	// Save the current state for docking panes.
	CXTPDockingPaneLayout layoutNormal(&m_paneManager);
	m_paneManager.GetLayout(&layoutNormal);
	layoutNormal.Save(_T("NormalLayout"));

	CMDIFrameWnd::OnClose();
#endif
}

QuestionIdeas for an embedded interactive console? Pin
z33z29-Dec-09 3:24
z33z29-Dec-09 3:24 
AnswerRe: Ideas for an embedded interactive console? Pin
raja jamwal31-Dec-09 8:30
raja jamwal31-Dec-09 8:30 
QuestionIs there any way to execute XQuery through MFC or C++ Pin
A&Ms29-Dec-09 3:06
A&Ms29-Dec-09 3:06 
QuestionWhen my article will be publish?How many days in general? Pin
JunWang16329-Dec-09 0:29
JunWang16329-Dec-09 0:29 
AnswerWrong forum. Pin
CPallini29-Dec-09 0:47
mveCPallini29-Dec-09 0:47 
Questioncreating dbf file and reading info from dbf Pin
kir_MFC29-Dec-09 0:18
kir_MFC29-Dec-09 0:18 
QuestionRe: creating dbf file and reading info from dbf Pin
KingsGambit29-Dec-09 0:36
KingsGambit29-Dec-09 0:36 
AnswerRe: creating dbf file and reading info from dbf Pin
kir_MFC29-Dec-09 2:05
kir_MFC29-Dec-09 2:05 
GeneralRe: creating dbf file and reading info from dbf Pin
mav@octaval29-Dec-09 2:10
mav@octaval29-Dec-09 2:10 
AnswerRe: creating dbf file and reading info from dbf Pin
dxlee29-Dec-09 3:21
dxlee29-Dec-09 3:21 
AnswerRe: creating dbf file and reading info from dbf Pin
David Crow29-Dec-09 3:34
David Crow29-Dec-09 3:34 
AnswerRe: creating dbf file and reading info from dbf Pin
Hamid_RT29-Dec-09 19:34
Hamid_RT29-Dec-09 19:34 
QuestionTwo Dialogs in Application class Pin
Anu_Bala28-Dec-09 22:46
Anu_Bala28-Dec-09 22:46 
AnswerRe: Two Dialogs in Application class Pin
KingsGambit28-Dec-09 23:28
KingsGambit28-Dec-09 23:28 
GeneralRe: Two Dialogs in Application class Pin
Anu_Bala28-Dec-09 23:59
Anu_Bala28-Dec-09 23:59 
AnswerRe: Two Dialogs in Application class Pin
Nelek28-Dec-09 23:55
protectorNelek28-Dec-09 23:55 
Questionunistd.h Pin
mortaza mardani28-Dec-09 21:50
mortaza mardani28-Dec-09 21:50 

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.