Hey guys can someone show me how to get currently running processes and add them to a listbox with handle hStaticx. I'll be very grateful if someone could help.
~Cha0sBG
Printable View
Hey guys can someone show me how to get currently running processes and add them to a listbox with handle hStaticx. I'll be very grateful if someone could help.
~Cha0sBG
here is a simple code that print out to a standart console window the current running proccess(that aren't hidden or anything....).Code:
#include <windows.h>
#include <tlhelp32.H>
#include <iostream>
using namespace::std;
int main()
{
HANDLE process;
PROCESSENTRY32 ProcessList;
process = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
if (process == INVALID_HANDLE_VALUE)
{
return 0;
}
if(Process32First(process,&ProcessList)==FALSE)
{
return 0;
}
do
{
cout << ProcessList.szExeFile << " " << ProcessList.th32ProcessID << endl;
}while(Process32Next(process, &ProcessList) != FALSE);
return 0;
}
the PROCESSENTRY32 structure contains many more information that you might find useful.
hope it helped.
EDIT: Sorry just had the wrong control :S
There is no error checking in your code.
Make sure your code gets the process names properly.
Call MessageBox in the do..while loop.
No i just had the handle to a Static :D mixed it with my ListBox your code is perfect :)