implemented the "Go to process" feature

svn path=/trunk/; revision=18192
This commit is contained in:
Thomas Bluemel 2005-10-01 15:30:25 +00:00
parent 38ecd48776
commit 6526069195
2 changed files with 32 additions and 2 deletions

View file

@ -48,6 +48,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);
#if 0 #if 0
void SwitchToThisWindow ( void SwitchToThisWindow (
@ -936,9 +937,18 @@ void ApplicationPage_OnGotoProcess(void)
*/ */
TabCtrl_SetCurFocus(hTabWnd, 1); TabCtrl_SetCurFocus(hTabWnd, 1);
/* /*
* FIXME: Select the process item in the list * Select the process item in the list
*/ */
for (i=0; i<ListView_GetItemCount(hProcessPage); i++) { i = PerfGetIndexByProcessId(dwProcessId);
if (i != -1)
{
ListView_SetItemState(hProcessPageListCtrl,
i,
LVIS_SELECTED | LVIS_FOCUSED,
LVIS_SELECTED | LVIS_FOCUSED);
ListView_EnsureVisible(hProcessPageListCtrl,
i,
FALSE);
} }
} }
} }

View file

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