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