|
-
May 4th, 2004, 10:56 AM
#1
Make TimedMessageBox stays in MFC
I put TimedMessageBox code from MSDN in my code. When the MessageBox disappears, so is the MFC application, while it stays in place (does not quit MFC) if I replace it with ordinary MessageBox. How can I make the MFC application stay in place using this TimedMessageBox ?
This is the code:
//////////////////////////////////
//// MessageBoxTimer From MSDN
//////////////////////////////////
void CALLBACK
MessageBoxTimer(HWND hwnd, UINT uiMsg, UINT idEvent, DWORD dwTime)
{
PostQuitMessage(0);
}
UINT TimedMessageBox( HWND hwndParent,LPCTSTR ptszMessage,LPCTSTR ptszTitle,
UINT flags, DWORD dwTimeout)
{
UINT idTimer;
UINT uiResult;
MSG msg;
idTimer = SetTimer(NULL, 0, dwTimeout, (TIMERPROC)MessageBoxTimer);
uiResult = MessageBox(hwndParent, ptszMessage, ptszTitle, flags);
KillTimer(NULL, idTimer);
/* See if there is a WM_QUIT message in the queue. */
if (PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE))
{
uiResult = 0;
}
return uiResult;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|