Click here to Skip to main content
15,921,028 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How does a modal dialog work (message pump)? Pin
Joaquín M López Muñoz29-May-02 4:58
Joaquín M López Muñoz29-May-02 4:58 
GeneralRe: How does a modal dialog work (message pump)? Pin
Maximilien29-May-02 5:30
Maximilien29-May-02 5:30 
GeneralRe: How does a modal dialog work (message pump)? Pin
Joaquín M López Muñoz29-May-02 5:49
Joaquín M López Muñoz29-May-02 5:49 
GeneralRe: How does a modal dialog work (message pump)? Pin
29-May-02 5:28
suss29-May-02 5:28 
GeneralRe: How does a modal dialog work (message pump)? Pin
Joaquín M López Muñoz29-May-02 8:29
Joaquín M López Muñoz29-May-02 8:29 
GeneralRe: How does a modal dialog work (message pump)? Pin
29-May-02 13:13
suss29-May-02 13:13 
GeneralRe: How does a modal dialog work (message pump)? Pin
29-May-02 18:20
suss29-May-02 18:20 
GeneralRe: How does a modal dialog work? Code snippets Pin
29-May-02 13:36
suss29-May-02 13:36 
PPS: Here are the requested code snippets, perhaps it helps to trace the problem.

// Start engine main loop and show OpenGL window
BOOL CBlueSharkEngine::Run()
{
	if(!ShowWindow()) return FALSE;
	m_bEngineRunning=TRUE;
	m_timer.Init();
	for (;; )
	{	
		TRACE("\\Mainloop running\n");
		//EngineMain(m_timer.GetElapsedSeconds());
		if(!m_pWindow->PumpMessage()) break;
		TRACE("/Mainloop running\n");
	}
	TRACE("Mainloop leaving..\n");
	DestroyWindow();
	m_bEngineRunning=FALSE;
	return TRUE;
}


// Stop message handling to shut down engine
void CBlueSharkEngine::Stop()
{
	if(m_bEngineRunning) PostQuitMessage(0);
}


// Handle messages in event queue
BOOL CBlueSharkEngineWindow::PumpMessage()
{
	MSG msg;
	TRACE(" \\PumpMessage\n");
	while (::PeekMessage (&msg,NULL,0,0,PM_NOREMOVE))	
	{
		TRACE("  PumpMessage message 0x%04x\n",msg.message);
		if (!::GetMessage (&msg, NULL, 0, 0)) 
		{
			TRACE(" /PumpMessage WM_QUIT\n");
			return FALSE;
		}
		::TranslateMessage (&msg);
		::DispatchMessage (&msg);
	}
	TRACE(" /PumpMessage\n"); //debug
	return TRUE;
}


// Destructors
CBlueSharkEngine:: ~CBlueSharkEngine()
{
	Stop();
	assert(!m_bEngineRunning);
	DestroyWindow();
	if(m_pWindow)    delete m_pWindow;
	if(m_pTexture)   delete m_pTexture;
	if(m_pFont)      delete m_pFont;
	if(m_pInterface) delete m_pInterface;
}

CBlueSharkEngineWindow:: ~CBlueSharkEngineWindow() {}

GeneralRe: How does a modal dialog work? Code snippets Pin
Joaquín M López Muñoz29-May-02 23:12
Joaquín M López Muñoz29-May-02 23:12 
GeneralRe: How does a modal dialog work? Workaround Pin
30-May-02 0:50
suss30-May-02 0:50 
GeneralRe: How does a modal dialog work? Workaround Pin
Joaquín M López Muñoz30-May-02 2:36
Joaquín M López Muñoz30-May-02 2:36 
GeneralRe: How does a modal dialog work? Workaround Pin
30-May-02 6:59
suss30-May-02 6:59 
GeneralRe: How does a modal dialog work? Workaround Pin
Joaquín M López Muñoz1-Jun-02 5:28
Joaquín M López Muñoz1-Jun-02 5:28 
AnswerRe: How does a modal dialog work (message pump)? Pin
Paul M Watt29-May-02 7:24
mentorPaul M Watt29-May-02 7:24 
GeneralFile Type Association Pin
moobob29-May-02 4:34
moobob29-May-02 4:34 
GeneralRe: File Type Association Pin
Mauricio Ritter29-May-02 6:27
Mauricio Ritter29-May-02 6:27 
GeneralRe: File Type Association Pin
moobob29-May-02 7:06
moobob29-May-02 7:06 
GeneralCombo box without dropdown button Pin
ed987129-May-02 4:03
ed987129-May-02 4:03 
GeneralRe: Combo box without dropdown button Pin
dlhson29-May-02 6:09
dlhson29-May-02 6:09 
GeneralRe: Combo box without dropdown button Pin
ed987129-May-02 7:15
ed987129-May-02 7:15 
GeneralRe: Combo box without dropdown button Pin
aldeba29-May-02 23:48
aldeba29-May-02 23:48 
GeneralConvert a HRESULT to a string Pin
Anders Molin29-May-02 3:32
professionalAnders Molin29-May-02 3:32 
GeneralRe: Convert a HRESULT to a string Pin
Philippe Mori29-May-02 3:49
Philippe Mori29-May-02 3:49 
GeneralRe: Convert a HRESULT to a string Pin
CodeGuy29-May-02 3:44
CodeGuy29-May-02 3:44 
GeneralSubclassing a static control Pin
Cathy29-May-02 3:03
Cathy29-May-02 3:03 

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.