|
-
April 21st, 1999, 08:55 PM
#1
How can I capture the window quit message?
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);
: ispatchMessage(&msg);
}
i++;
}
}
-
April 30th, 1999, 08:45 AM
#2
Re: How can I capture the window quit message?
Why you capture the message in your OnStart2()
function,you can override the window's WndProc()
function,in it you can judge the message.Try it,
you will find it works.
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
|