| | |
List running processes
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2008
Posts: 4
Reputation:
Solved Threads: 0
I am trying to write a program, for practice, similar to the task manager, that lists running process, and their path if possible. I have spent hours all over Google and I can't find anything. Ideally, it would be nice to put the processes and their paths into an array, in this format:
Any ideas?
C++ Syntax (Toggle Plain Text)
list[0] = "C:\Game.exe"; list[1] = "C:\MusicPlayer.exe"; list[2] = "C:\Calculator.exe";
Any ideas?
Use CreateToolhelp32Snapshot() with the TH32CS_SNAPPROCESS flag and Process32First() and Process32Next() to get a list of processes on the system.
For each process, create another snapshot using the TH32CS_SNAPMODULE flag and the process ID. For each module ID use GetModuleFileName(), and look for the modules whose names end in ".exe".
The MSDN toolhelp documetation gives examples like how to traverese the module list.
Don't forget to use CloseHandle() on each snapshot when you are done with it.
Hope this helps.
For each process, create another snapshot using the TH32CS_SNAPMODULE flag and the process ID. For each module ID use GetModuleFileName(), and look for the modules whose names end in ".exe".
The MSDN toolhelp documetation gives examples like how to traverese the module list.
Don't forget to use CloseHandle() on each snapshot when you are done with it.
Hope this helps.
![]() |
Similar Threads
- Computer is running very slow (Viruses, Spyware and other Nasties)
- hijack this list, bridge.dll (Viruses, Spyware and other Nasties)
- help please re: downloader siboco B virus (Viruses, Spyware and other Nasties)
- Virus, Adware, or just explorer causing malfunctions-res://mshp.dll/http_404.htm (Viruses, Spyware and other Nasties)
- i have a dialer or something running in background.. (Web Browsers)
- wow 37 pop ups (Web Browsers)
- System Processes in XP? NetTsk.exe? (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: Pointer and null terminating character
- Next Thread: How do I combine a retrieved registrypath with a string and reformat information?
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






