View Single Post
Old June 9th, 2009   #30 (permalink)
@ruantec
Emu author
 
@ruantec's Avatar
 
Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,381
Quote:
Originally Posted by S.T.A.R.S. View Post
Lol rauntec.I know what I need to do to get the current processes.The thing I don't know is WHAT I need to do to get the extension for EACH process.This code that I gave here shows the current processes like for example "notepad"....blablabla.What I want to do is how to show the EACH process extension,for example--->"notepad.exe"<---You can here see the EXE extension.

So how to display the extension for EACH process??????
lol thatīs quite easy.. for that you are going to need the modules on each process... the processname.modules have a collection of modules of type "ProcessModule" you can use it like that:

Code:
        private void button1_Click(object sender, EventArgs e)
        {
            Process[] procs = Process.GetProcesses(".");
            foreach (Process process in procs)
            {
                try
                {
                    foreach (ProcessModule modul in process.Modules)
                    {
                        listBox1.Items.Add(modul.ModuleName);

                        //Here some more in case you need them
                        //modul.FileName;
                        //modul.ModuleMemorySize.ToString();
                        //modul.FileVersionInfo.FileVersion;
                    }
                }
                catch { }
            }
        }
there you go...

Tip from me....
a good way to find things out by yourself is by using a break poing and move your mouse over the object you want to explore... explore the required objects and you can browse every single part of it without problems just like this:
__________________

Current development tools:

Visual C++.net, Visual C#.net
Visual VB.net, Visual Webdeveloper.net
Bloodshed Dev C++, Borland C++
Visual Basic 6

Last edited by @ruantec; June 9th, 2009 at 21:44..
@ruantec is offline   Reply With Quote