Last Updated 2004/04/25
Programming Tips Visual C++ API  索 引 
メッセージポンプ
2004/04/25

VB で言うところの DoEvents() である.
長いループの途中などで呼び出す.

void DoEvents()
{
    MSG msg;
    while( ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) {
        ::TranslateMessage( &msg );
        ::DispatchMessage( &msg );
    }
}


BOOL DoEvents()
{
    MSG msg;
    while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
        if( !GetMessage(&msg, NULL, 0, 0) ) {
            return FALSE;   // WM_QUIT を受け取り
        }
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return TRUE;
}


参照
中止ダイアログ
プログレスダイアログ
前後のTips
メッセージポンプ

DSS ProgrammingTipsCGI Ver2.02