- use PostMessage(WM_SYSCOMMAND) instead of ShowWindowAsync(SW_MINIMIZE) to minimize application windows when clicking on the taskbar

-> for example mIRC needs this to "minimize to the tray"
- fix determination of the last foreground window

svn path=/trunk/; revision=7858
This commit is contained in:
Martin Fuchs 2004-01-24 10:12:40 +00:00
parent 19f91f8fd9
commit 1d58bfad3b

View file

@ -192,12 +192,12 @@ void TaskBar::ActivateApp(TaskBarMap::iterator it, bool can_minimize)
HWND hwnd = it->first;
if (can_minimize && (hwnd==GetForegroundWindow() || hwnd==_last_foreground_wnd)) {
ShowWindowAsync(hwnd, SW_MINIMIZE);
PostMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
_last_foreground_wnd = 0;
} else {
// switch to selected application window
if (IsIconic(hwnd))
ShowWindowAsync(hwnd, SW_RESTORE);
PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
SetForegroundWindow(hwnd);
@ -297,8 +297,10 @@ BOOL CALLBACK TaskBar::EnumWndProc(HWND hwnd, LPARAM lparam)
++entry._used;
btn.idCommand = entry._id;
if (hwnd == GetForegroundWindow())
if (hwnd == GetForegroundWindow()) {
btn.fsState |= TBSTATE_PRESSED|TBSTATE_CHECKED;
pThis->_last_foreground_wnd = hwnd;
}
if (!last_id) {
// create new toolbar buttons for new windows