Из msdn нашла, как получить список того и того.
Подскажите пожалуйста, как теперь получить их свойства?
void PrintProcessNameAndID( DWORD processID, unsigned int i)
{
TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>");
// Get a handle to the process.
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ,
FALSE, processID );
// Get the process name.
if (NULL != hProcess )
{
HMODULE hMod;
DWORD cbNeeded;
if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod),
&cbNeeded) )
{
GetModuleBaseName( hProcess, hMod, szProcessName,
sizeof(szProcessName)/sizeof(TCHAR) );
}
}
// Print the process name and identifier.
wsprintf(pszStrPID,_T("%d %s (PID: %u)"), i,szProcessName, processID);
SendMessage(hListBoxAllInfo,LB_ADDSTRING, 0, (LPARAM)(LPCSTR)pszStrPID);
//_tprintf( TEXT("%s (PID: %u)\n"), szProcessName, processID );
CloseHandle( hProcess );
}
void PrintModules( DWORD processID )
{
HMODULE hMods[1024];
HANDLE hProcess;
DWORD cbNeeded;
unsigned int i;
// Print the process identifier.
wsprintf(pszStrPID,_T(" Process ID: %u"), processID);
SendMessage(hListBoxAllInfo,LB_ADDSTRING, 0, (LPARAM)(LPCSTR)pszStrPID);
//printf( " Process ID: %u", processID );//<----
// Get a list of all the modules in this process.
hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ,
FALSE, processID );
if (NULL == hProcess)
return;
if( EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbNeeded))
{
for ( i = 0; i < (cbNeeded / sizeof(HMODULE)); i++ )
{
TCHAR szModName[MAX_PATH];
// Get the full path to the module's file.
if ( GetModuleFileNameEx(hProcess, hMods[i], szModName,
sizeof(szModName)/sizeof(TCHAR)))
{
// Print the module name and handle value.
wsprintf(pszStrPID,_T("%s (0x%08X)"),szModName, hMods[i]);
SendMessage(hListBoxAllInfo,LB_ADDSTRING, 0, (LPARAM)(LPCSTR)pszStrPID);
// _tprintf(TEXT("\t%s (0x%08X)\n"),
// szModName, hMods[i]);
}
}
}
CloseHandle( hProcess );
}
void OnClickButAllData(HWND hwnd)
{
RECT Rect;
GetClientRect(hwnd,&Rect);
unsigned int i;
// Get the list of process identifiers.
DWORD aProcesses[1024], cbNeeded, cProcesses;
wsprintf(pszStrPID,_T("_Name_of_Process__(PID)_"));
SendMessage(hListBoxAllInfo,LB_ADDSTRING, 0, (LPARAM)(LPCSTR)pszStrPID);
if (!EnumProcesses(aProcesses, sizeof(aProcesses),&cbNeeded))
MessageBox(hWndMain,TEXT("Error!"),TEXT("WARNING"),MB_ICONERROR);
// Calculate how many process identifiers were returned.
cProcesses = cbNeeded / sizeof(DWORD);
wsprintf(pszStrPID,_T("There are %d processes:"),cProcesses-1);
SendMessage(hListBoxAllInfo,LB_ADDSTRING, 0, (LPARAM)(LPCSTR)pszStrPID);
// Print the name and process identifier for each process.
for ( i = 0; i < cProcesses; i++ )
if( aProcesses[i] != 0 )
{
PrintProcessNameAndID( aProcesses[i],i);
PrintModules( aProcesses[i]);
}
}