MFCでDoEvent

void DoEvents()
{
    MSG msg;
    while(::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE))
    {
        if (!AfxGetApp()->PumpMessage())
        return;
    }
}