Author: hbelusca
Date: Mon Dec 15 20:33:26 2014
New Revision: 65676
URL:
http://svn.reactos.org/svn/reactos?rev=65676&view=rev
Log:
[TASKMGR]: Disable the "End process" button if no item is selected.
Part 1 of a patch by Edijs.
CORE-5655 #comment procpage.c fix committed.
Modified:
trunk/reactos/base/applications/taskmgr/procpage.c
Modified: trunk/reactos/base/applications/taskmgr/procpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- 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:33:26
2014
@@ -33,12 +33,13 @@
ULONG ProcessId;
} PROCESS_PAGE_LIST_ITEM, *LPPROCESS_PAGE_LIST_ITEM;
-HWND hProcessPage; /* Process List Property Page */
-
-HWND hProcessPageListCtrl; /* Process ListCtrl Window */
+HWND hProcessPage; /* Process List Property Page */
+
+HWND hProcessPageListCtrl; /* Process ListCtrl Window */
HWND hProcessPageHeaderCtrl; /* Process Header Control */
-HWND hProcessPageEndProcessButton; /* Process End Process button */
+HWND hProcessPageEndProcessButton; /* Process End Process button */
HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
+BOOL bProcessPageSelectionMade = FALSE; /* Is item in ListCtrl selected */
static int nProcessPageWidth;
static int nProcessPageHeight;
@@ -102,6 +103,15 @@
return 0;
}
+void ProcessPageUpdate(void)
+{
+ /* Enable or disable the "End Process" button */
+ if (ListView_GetSelectedCount(hProcessPageListCtrl))
+ EnableWindow(hProcessPageEndProcessButton, TRUE);
+ else
+ EnableWindow(hProcessPageEndProcessButton, FALSE);
+}
+
INT_PTR CALLBACK
ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
@@ -147,6 +157,10 @@
/* Start our refresh thread */
hProcessThread = CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0,
&dwProcessThread);
#endif
+
+ /* Refresh controls */
+ ProcessPageUpdate();
+
return TRUE;
case WM_DESTROY:
@@ -230,11 +244,9 @@
{
switch (pnmh->code)
{
- #if 0
case LVN_ITEMCHANGED:
ProcessPageUpdate();
break;
- #endif
case LVN_GETDISPINFO:
@@ -466,6 +478,20 @@
}
SendMessage(hProcessPageListCtrl, WM_SETREDRAW, TRUE, 0);
+
+ /* Select first item if any */
+ if ((ListView_GetNextItem(hProcessPageListCtrl, -1, LVNI_SELECTED | LVNI_FOCUSED) ==
-1) &&
+ (ListView_GetItemCount(hProcessPageListCtrl) > 0) &&
!bProcessPageSelectionMade)
+ {
+ ListView_SetItemState(hProcessPageListCtrl, 0, LVIS_FOCUSED | LVIS_SELECTED,
LVIS_FOCUSED | LVIS_SELECTED);
+ bProcessPageSelectionMade = TRUE;
+ }
+ /*
+ else
+ {
+ bProcessPageSelectionMade = FALSE;
+ }
+ */
}
BOOL ProcessRunning(ULONG ProcessId)