mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 04:23:02 +00:00
[TASKMGR] Avoid hangs as much as possible (#4166)
- Use ShowWindowAsync instead of ShowWindow. - Use SwitchToThisWindow directly. CORE-17894
This commit is contained in:
parent
0b6f3eb8e4
commit
545e1190f2
1 changed files with 6 additions and 26 deletions
|
@ -5,6 +5,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||||
* 2005 Klemens Friedl <frik85@reactos.at>
|
* 2005 Klemens Friedl <frik85@reactos.at>
|
||||||
|
* 2021 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -57,13 +58,6 @@ static HANDLE hApplicationThread = NULL;
|
||||||
static DWORD dwApplicationThread;
|
static DWORD dwApplicationThread;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
void SwitchToThisWindow (
|
|
||||||
HWND hWnd, /* Handle to the window that should be activated */
|
|
||||||
BOOL bRestore /* Restore the window if it is minimized */
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static INT
|
static INT
|
||||||
GetSystemColorDepth(VOID)
|
GetSystemColorDepth(VOID)
|
||||||
{
|
{
|
||||||
|
@ -785,7 +779,7 @@ void ApplicationPage_OnWindowsMinimize(void)
|
||||||
if (item.state & LVIS_SELECTED) {
|
if (item.state & LVIS_SELECTED) {
|
||||||
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
|
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
|
||||||
if (pAPLI) {
|
if (pAPLI) {
|
||||||
ShowWindow(pAPLI->hWnd, SW_MINIMIZE);
|
ShowWindowAsync(pAPLI->hWnd, SW_MINIMIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,7 +800,7 @@ void ApplicationPage_OnWindowsMaximize(void)
|
||||||
if (item.state & LVIS_SELECTED) {
|
if (item.state & LVIS_SELECTED) {
|
||||||
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
|
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
|
||||||
if (pAPLI) {
|
if (pAPLI) {
|
||||||
ShowWindow(pAPLI->hWnd, SW_MAXIMIZE);
|
ShowWindowAsync(pAPLI->hWnd, SW_MAXIMIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -859,9 +853,7 @@ void ApplicationPage_OnWindowsBringToFront(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pAPLI) {
|
if (pAPLI) {
|
||||||
if (IsIconic(pAPLI->hWnd))
|
SwitchToThisWindow(pAPLI->hWnd, TRUE);
|
||||||
ShowWindow(pAPLI->hWnd, SW_RESTORE);
|
|
||||||
BringWindowToTop(pAPLI->hWnd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -884,21 +876,9 @@ void ApplicationPage_OnSwitchTo(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pAPLI) {
|
if (pAPLI) {
|
||||||
typedef void (WINAPI *PROCSWITCHTOTHISWINDOW) (HWND, BOOL);
|
SwitchToThisWindow(pAPLI->hWnd, TRUE);
|
||||||
PROCSWITCHTOTHISWINDOW SwitchToThisWindow;
|
|
||||||
|
|
||||||
HMODULE hUser32 = GetModuleHandleW(L"USER32");
|
|
||||||
SwitchToThisWindow = (PROCSWITCHTOTHISWINDOW)GetProcAddress(hUser32, "SwitchToThisWindow");
|
|
||||||
if (SwitchToThisWindow) {
|
|
||||||
SwitchToThisWindow(pAPLI->hWnd, TRUE);
|
|
||||||
} else {
|
|
||||||
if (IsIconic(pAPLI->hWnd))
|
|
||||||
ShowWindow(pAPLI->hWnd, SW_RESTORE);
|
|
||||||
BringWindowToTop(pAPLI->hWnd);
|
|
||||||
SetForegroundWindow(pAPLI->hWnd);
|
|
||||||
}
|
|
||||||
if (TaskManagerSettings.MinimizeOnUse)
|
if (TaskManagerSettings.MinimizeOnUse)
|
||||||
ShowWindow(hMainWnd, SW_MINIMIZE);
|
ShowWindowAsync(hMainWnd, SW_MINIMIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue