|
-
May 11th, 1999, 04:54 PM
#1
Usage of PeekMessage().....
I'm trying to use PeekMessage() to search thro' the message queue for a dialog and I want to break-off the PeekMessage() loop on encountering a specific message (e.g , WM_CLOSE). How should I do this..??
while( PeekMessage())
{
if the message is WM_CLOSE, fall off this loop
}
//control should come here.....
Any help is greatly appreciated. Any other better ideas are welcome too.....
Thanx
Ram
-
May 11th, 1999, 06:54 PM
#2
Re: Usage of PeekMessage().....
I use th following function for my dialog:
BOOL WorkingDlg::IsCancelled()
{
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT ||
msg.message == WM_CLOSE ||
msg.message == WM_DESTROY
)
m_bCancel = TRUE;
TranslateMessage(&msg);// Translates virtual key codes
DispatchMessage(&msg); // Dispatches message to window
}
return m_bCancel;
}
This function will be called by other program to see if user clicks the "Cancel" button or close the dialog.
Hope this will help. Good luck.
Allen
-
May 12th, 1999, 08:49 AM
#3
Re: Usage of PeekMessage().....
That helped. Thanx a lot.
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
|