Author: hbelusca Date: Mon Dec 15 20:45:38 2014 New Revision: 65677
URL: http://svn.reactos.org/svn/reactos?rev=65677&view=rev Log: [TASKMGR]: Disable the "End task" button if no item is selected. Part 2 of a patch by Edijs. CORE-5655 #comment Patch committed. When one of you will have a patch for the Windows-menu items disabled bug, please reopen the report. #resolve
Modified: trunk/reactos/base/applications/taskmgr/applpage.c trunk/reactos/base/applications/taskmgr/procpage.c
Modified: trunk/reactos/base/applications/taskmgr/applpage.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/a... ============================================================================== --- trunk/reactos/base/applications/taskmgr/applpage.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/taskmgr/applpage.c [iso-8859-1] Mon Dec 15 20:45:38 2014 @@ -41,6 +41,8 @@ static BOOL bSortAscending = TRUE; DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter); BOOL noApps; +BOOL bApplicationPageSelectionMade = FALSE; + BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam); void AddOrUpdateHwnd(HWND hWnd, WCHAR *szTitle, HICON hIcon, BOOL bHung); void ApplicationPageUpdate(void); @@ -138,6 +140,10 @@ #ifdef RUN_APPS_PAGE hApplicationThread = CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, &dwApplicationThread); #endif + + /* Refresh page */ + ApplicationPageUpdate(); + return TRUE;
case WM_DESTROY: @@ -272,7 +278,10 @@ noApps = TRUE; EnumWindows(EnumWindowsProc, 0); if (noApps) + { (void)ListView_DeleteAllItems(hApplicationPageListCtrl); + bApplicationPageSelectionMade = FALSE; + }
/* Get the image lists */ hImageListLarge = ListView_GetImageList(hApplicationPageListCtrl, LVSIL_NORMAL); @@ -457,7 +466,20 @@ item.lParam = (LPARAM)pAPLI; (void)ListView_InsertItem(hApplicationPageListCtrl, &item); } - return; + + /* Select first item if any */ + if ((ListView_GetNextItem(hApplicationPageListCtrl, -1, LVNI_FOCUSED | LVNI_SELECTED) == -1) && + (ListView_GetItemCount(hApplicationPageListCtrl) > 0) && !bApplicationPageSelectionMade) + { + ListView_SetItemState(hApplicationPageListCtrl, 0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); + bApplicationPageSelectionMade = TRUE; + } + /* + else + { + bApplicationPageSelectionMade = FALSE; + } + */ }
void ApplicationPageUpdate(void)
Modified: trunk/reactos/base/applications/taskmgr/procpage.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/p... ============================================================================== --- trunk/reactos/base/applications/taskmgr/procpage.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/taskmgr/procpage.c [iso-8859-1] Mon Dec 15 20:45:38 2014 @@ -158,7 +158,7 @@ hProcessThread = CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, &dwProcessThread); #endif
- /* Refresh controls */ + /* Refresh page */ ProcessPageUpdate();
return TRUE; @@ -433,6 +433,8 @@ wsprintfW(text, szProcesses, OldProcessCount); SendMessageW(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text); } + + ProcessPageUpdate(); } } return 0; @@ -480,7 +482,7 @@ SendMessage(hProcessPageListCtrl, WM_SETREDRAW, TRUE, 0);
/* Select first item if any */ - if ((ListView_GetNextItem(hProcessPageListCtrl, -1, LVNI_SELECTED | LVNI_FOCUSED) == -1) && + if ((ListView_GetNextItem(hProcessPageListCtrl, -1, LVNI_FOCUSED | LVNI_SELECTED) == -1) && (ListView_GetItemCount(hProcessPageListCtrl) > 0) && !bProcessPageSelectionMade) { ListView_SetItemState(hProcessPageListCtrl, 0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);