ProcessModule.ModuleName : ProcessModule « System.Diagnostics « C# / C Sharp by API






ProcessModule.ModuleName

 


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