I have a function triggered by a message(WM_ONDATA defined by me) the function will execute this code :
MSG msg;
while(::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if( !AfxGetApp()->PumpMessage() )
{
::PostQuitMessage(0);
return 0;
}
}
return 1;
The problem is that there could be on the message queue another message that could trigger the function.
I’m wondering if I can make it process all the message but WM_ONDATA?
You could get the window proc to ignore the message or to queue it’s execution. If you’re just looking to avoid recursion, have a reentrance lock
….
You could get fancy with a scoped RIIA struct (so things will be exception safe and slightly less verbose)