How does Windows (specifically, Vista) determine if my application is hung?

前端 未结 2 2079
攒了一身酷
攒了一身酷 2021-02-14 22:08

I have a problem very similar to the one described here: http://www.eggheadcafe.com/software/aspnet/30579866/prevent-vista-from-markin.aspx

That thread suggests that Tas

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-14 22:17

    The solution is one additional call after the dispatching of your messages.

    
    // check for my messages
    while (PeekMessage(&msg, NULL, WM_TIMER, WM_TIMER, PM_REMOVE) ||
            PeekMessage(&msg, NULL, 0x0118, 0x0118, PM_REMOVE))
     {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
     }
    
    // only to prevent ghost-window on vista!
    // we dont use the result and let the message in the queue (PM_NOREMOVE)
    PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
    
    

提交回复
热议问题