mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:02:58 +00:00
[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:
parent
d20419ee58
commit
13478858b7
3 changed files with 26 additions and 25 deletions
|
@ -49,7 +49,7 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam);
|
||||||
void ApplicationPageShowContextMenu1(void);
|
void ApplicationPageShowContextMenu1(void);
|
||||||
void ApplicationPageShowContextMenu2(void);
|
void ApplicationPageShowContextMenu2(void);
|
||||||
int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
|
int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
|
||||||
int PerfGetIndexByProcessId(DWORD dwProcessId);
|
int ProcGetIndexByProcessId(DWORD dwProcessId);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void SwitchToThisWindow (
|
void SwitchToThisWindow (
|
||||||
|
@ -878,7 +878,6 @@ void ApplicationPage_OnGotoProcess(void)
|
||||||
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
|
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
|
||||||
LV_ITEM item;
|
LV_ITEM item;
|
||||||
int i;
|
int i;
|
||||||
/* NMHDR nmhdr; */
|
|
||||||
|
|
||||||
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
|
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
|
||||||
memset(&item, 0, sizeof(LV_ITEM));
|
memset(&item, 0, sizeof(LV_ITEM));
|
||||||
|
@ -902,7 +901,7 @@ void ApplicationPage_OnGotoProcess(void)
|
||||||
/*
|
/*
|
||||||
* Select the process item in the list
|
* Select the process item in the list
|
||||||
*/
|
*/
|
||||||
i = PerfGetIndexByProcessId(dwProcessId);
|
i = ProcGetIndexByProcessId(dwProcessId);
|
||||||
if (i != -1)
|
if (i != -1)
|
||||||
{
|
{
|
||||||
ListView_SetItemState(hProcessPageListCtrl,
|
ListView_SetItemState(hProcessPageListCtrl,
|
||||||
|
|
|
@ -387,27 +387,6 @@ BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, int nMaxCount)
|
||||||
return bSuccessful;
|
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 PerfDataGetProcessId(ULONG Index)
|
||||||
{
|
{
|
||||||
ULONG ProcessId;
|
ULONG ProcessId;
|
||||||
|
|
|
@ -54,6 +54,27 @@ BOOL PerfDataGetText(ULONG Index, ULONG ColumnIndex, LPTSTR lpText, int nMaxCoun
|
||||||
DWORD WINAPI ProcessPageRefreshThread(void *lpParameter);
|
DWORD WINAPI ProcessPageRefreshThread(void *lpParameter);
|
||||||
int ProcessRunning(ULONG ProcessId);
|
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)
|
DWORD GetSelectedProcessId(void)
|
||||||
{
|
{
|
||||||
int Index;
|
int Index;
|
||||||
|
@ -427,7 +448,9 @@ void UpdateProcesses()
|
||||||
pData = (LPPROCESS_PAGE_LIST_ITEM)item.lParam;
|
pData = (LPPROCESS_PAGE_LIST_ITEM)item.lParam;
|
||||||
if (!ProcessRunning(pData->ProcessId))
|
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);
|
HeapFree(GetProcessHeap(), 0, pData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue