Laurence
April 21st, 1999, 08:55 PM
In the following code, I want to capture the window quit or close message. but I cannot get it using the following code. How can I do?
Thanks.
void CEx1Dlg::OnStart2()
{
// TODO: Add your control notification handler code here
int i = 0;
BOOL ret;
MSG msg;
while(1)
{
ret = ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
if(ret)
{
if((msg.message == WM_QUIT) || (msg.message == WM_DESTROY) || (msg.message == WM_CLOSE))
{
AfxMessageBox("Quit message received!");
break;
}
TRACE("MSG :%d\n", msg.message);
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
i++;
}
}
Thanks.
void CEx1Dlg::OnStart2()
{
// TODO: Add your control notification handler code here
int i = 0;
BOOL ret;
MSG msg;
while(1)
{
ret = ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
if(ret)
{
if((msg.message == WM_QUIT) || (msg.message == WM_DESTROY) || (msg.message == WM_CLOSE))
{
AfxMessageBox("Quit message received!");
break;
}
TRACE("MSG :%d\n", msg.message);
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
i++;
}
}