View Full Version : Get All Running Process Win32
METEOR7
30th November 2011, 14:55
Hi
How I Get List Of Running Process On Windows
And Thanks:)
Sorry For Much Qustion:confused:
Oleg
30th November 2011, 15:03
EnumProcesses function (http://msdn.microsoft.com/en-us/library/ms682629.aspx)
METEOR7
30th November 2011, 15:15
I Tested That
But I Have Problem:mad:
Oleg
30th November 2011, 15:35
It works fine for me, so explain your problem.
METEOR7
30th November 2011, 20:14
This is Error
undefined reference to `EnumProcesses@12'
The Error in Code :
if (!EnumProcesses(aProcesses,sizeof(&aProcesses),&cbNeeded))return;
stampede
30th November 2011, 22:00
From the docs:
Kernel32.dll on Windows 7 and Windows Server 2008 R2;
Psapi.dll if PSAPI_VERSION=1 on Windows 7 and Windows Server 2008 R2;
Psapi.dll on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000
Make sure you link to correct library (specifying -L"path/to/lib/dir" -llibrary_name).
SIFE
1st December 2011, 00:42
Try this:
void YourClass::monitor()
{
unsigned long aProcesses[1024], cbNeeded, cProcesses;
if(!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
cout << "text01";
QStringList lprocess;
cProcesses = cbNeeded / sizeof(unsigned long);
for(unsigned int i = 0; i < cProcesses; i++)
{
if(aProcesses[i] == 0)
continue;
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, aProcesses[i]);
wchar_t buffer[50];
GetModuleBaseName(hProcess, 0, buffer, 50);
CloseHandle(hProcess);
lprocess << QString::fromWCharArray(buffer);
}
}
Add this to you pro file project:
win32:LIBS += -lpsapi -lmingw32
METEOR7
4th December 2011, 13:05
Thanks For All
Code Worked Fine
:o
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.