[TASKMGR]

- Don't try to query a performance index when switching from application to process tab
- Query a process index instead: "go to process" works now

svn path=/trunk/; revision=46782
This commit is contained in:
Gregor Schneider 2010-04-08 22:10:45 +00:00
parent d20419ee58
commit 13478858b7
3 changed files with 26 additions and 25 deletions

View file

@ -49,7 +49,7 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam);
void ApplicationPageShowContextMenu1(void);
void ApplicationPageShowContextMenu2(void);
int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
int PerfGetIndexByProcessId(DWORD dwProcessId);
int ProcGetIndexByProcessId(DWORD dwProcessId);
#if 0
void SwitchToThisWindow (
@ -878,7 +878,6 @@ void ApplicationPage_OnGotoProcess(void)
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
/* NMHDR nmhdr; */
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM));
@ -902,7 +901,7 @@ void ApplicationPage_OnGotoProcess(void)
/*
* Select the process item in the list
*/
i = PerfGetIndexByProcessId(dwProcessId);
i = ProcGetIndexByProcessId(dwProcessId);
if (i != -1)
{
ListView_SetItemState(hProcessPageListCtrl,

View file

@ -387,27 +387,6 @@ BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, int nMaxCount)
return bSuccessful;
}
int PerfGetIndexByProcessId(DWORD dwProcessId)
{
int FoundIndex = -1;
ULONG Index;
EnterCriticalSection(&PerfDataCriticalSection);
for (Index = 0; Index < ProcessCount; Index++)
{
if (PtrToUlong(pPerfData[Index].ProcessId) == dwProcessId)
{
FoundIndex = Index;
break;
}
}
LeaveCriticalSection(&PerfDataCriticalSection);
return FoundIndex;
}
ULONG PerfDataGetProcessId(ULONG Index)
{
ULONG ProcessId;

View file

@ -54,6 +54,27 @@ BOOL PerfDataGetText(ULONG Index, ULONG ColumnIndex, LPTSTR lpText, int nMaxCoun
DWORD WINAPI ProcessPageRefreshThread(void *lpParameter);
int ProcessRunning(ULONG ProcessId);
int ProcGetIndexByProcessId(DWORD dwProcessId)
{
int i;
LVITEM item;
LPPROCESS_PAGE_LIST_ITEM pData;
for (i=0; i<ListView_GetItemCount(hProcessPageListCtrl); i++)
{
memset(&item, 0, sizeof(LV_ITEM));
item.mask = LVIF_PARAM;
item.iItem = i;
(void)ListView_GetItem(hProcessPageListCtrl, &item);
pData = (LPPROCESS_PAGE_LIST_ITEM)item.lParam;
if (PerfDataGetProcessId(pData->Index) == dwProcessId)
{
return i;
}
}
return 0;
}
DWORD GetSelectedProcessId(void)
{
int Index;
@ -427,7 +448,9 @@ void UpdateProcesses()
pData = (LPPROCESS_PAGE_LIST_ITEM)item.lParam;
if (!ProcessRunning(pData->ProcessId))
{
(void)ListView_DeleteItem(hProcessPageListCtrl, i);
MessageBox(NULL, L"Processs is dead", L"HM?", MB_OK);
if (ListView_DeleteItem(hProcessPageListCtrl, i) == FALSE)
MessageBox(NULL, L"Deletion failed", L"HM!", MB_OK);
HeapFree(GetProcessHeap(), 0, pData);
}
}