|
-
June 29th, 2009, 01:02 PM
#1
ProcessList
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
-
June 29th, 2009, 01:12 PM
#2
Re: ProcessList
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;
}
here is a simple code that print out to a standart console window the current running proccess(that aren't hidden or anything....).
the PROCESSENTRY32 structure contains many more information that you might find useful.
hope it helped.
-
June 29th, 2009, 01:14 PM
#3
-
June 29th, 2009, 01:22 PM
#4
Re: ProcessList
EDIT: Sorry just had the wrong control :S
Last edited by Cha0sBG; June 29th, 2009 at 01:25 PM.
-
June 29th, 2009, 01:24 PM
#5
Re: ProcessList
There is no error checking in your code.
Make sure your code gets the process names properly.
Call MessageBox in the do..while loop.
-
June 30th, 2009, 06:36 AM
#6
Re: ProcessList
No i just had the handle to a Static mixed it with my ListBox your code is perfect
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|