Process.Modules : Process « System.Diagnostics « C# / C Sharp by API






Process.Modules

 

using System;
using System.Diagnostics;

class MainClass
{
  public static void EnumModsForPid(int pID)
  {
    Process theProc;

    try {
        theProc = Process.GetProcessById(pID);
      } catch {
      Console.WriteLine("-> Sorry...bad PID!");
      return;
    }
    
    Console.WriteLine("Here are the loaded modules for: {0}", theProc.ProcessName);
    try
    {
      ProcessModuleCollection theMods = theProc.Modules;
      foreach(ProcessModule pm in theMods)
      {
        string info = string.Format("-> Mod Name: {0}", pm.ModuleName);
        Console.WriteLine(info);
      }
    }
    catch{Console.WriteLine("No mods!");}
  }

  static void Main(string[] args)
  {
    int theProcID = 10001;
    EnumModsForPid(theProcID);
  }
}

   
  








Related examples in the same category

1.Process.CloseMainWindow
2.Process.Exited
3.Process.GetCurrentProcess()
4.Process.GetProcessById
5.Process.Kill()
6.Process.PeakWorkingSet64
7.Process.PriorityClass
8.Process.PrivateMemorySize
9.Process.ProcessName
10.Process.StandardOutput.ReadToEnd()
11.Process.Start
12.Process.StartInfo.RedirectStandardOutput
13.Process.Threads
14.Process.TotalProcessorTime
15.Process.VirtualMemorySize
16.Process.WaitForExit
17.Process.WorkingSet