こんなんでいいのかな?
for (MSG msg; PeekMessage(& msg, NULL, 0, 0, PM_NOREMOVE); AfxGetThread()->PumpMessage());