Как делает Windows (а именно, Vista) определяют, подвешивается ли мое приложение?

Интересный вопрос. Я также использовал понимание списка, но с np.where. Тем не менее, я был бы удивлен, если бы не было менее неуклюжий путь.

df = pd.DataFrame({'column_1':['a','c'], 'column_2':['b','d']}, index=[1,2])

[(i, np.where(df[i] == 'd')[0].tolist()) for i in list(df) if len(np.where(df[i] == 'd')[0]) > 0]

> [[('column_2', [1])]

Обратите внимание, что он возвращает числовой индекс (на основе 0), а не пользовательский индекс (на основе 1). Если у вас есть фиксированное смещение, вы можете просто добавить +1 или что-то еще к выводу.

9
задан Community 23 May 2017 в 12:17
поделиться

2 ответа

TaskManager probably uses IsHungAppWindow to determine if an application is hung. Per MSDN, an application is considered hung if its not waiting for input, is not in startup processing, or has not not processed messages within 5 seconds. So no WM_NULL necessary.

You don't need to consume any specific messages - just regularly pump messages and move long tasks off of the UI thread. If you can get PeekMessage to be called every 0.5 seconds, replace it with something like:

while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
    TranslateMessage(&msg);
    DispatchMessage(&msg);
}

Which will completely drain your message queue and make you appear more responsive to the user. Do not filter individual messages such as mouse messages.. You should do this more than every 0.5 seconds if possible, and longer term try to move the long work off of the UI thread.

4
ответ дан 5 December 2019 в 01:19
поделиться

Решение одно дополнительный вызов после отправки ваших сообщений.


// 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);

0
ответ дан 5 December 2019 в 01:19
поделиться
Другие вопросы по тегам:

Похожие вопросы: