ProcessModule クラス
特定のプロセスに読み込まれた .dll ファイルまたは実行可能ファイル (.exe) を表します。
名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文
'宣言
Public Class ProcessModule
Inherits Component
'使用
Dim instance As ProcessModule
public class ProcessModule : Component
public ref class ProcessModule : public Component
public class ProcessModule extends Component
public class ProcessModule extends Component
解説
モジュールは、実行可能ファイルかダイナミック リンク ライブラリ (DLL) です。各プロセスは、1 つ以上のモジュールで構成されています。このクラスを使用して、モジュールに関する情報を取得できます。
使用例
Dim myProcess As New Process()
' Get the process start information of notepad.
Dim myProcessStartInfo As New ProcessStartInfo("notepad.exe")
' Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object.
myProcess.StartInfo = myProcessStartInfo
' Create a notepad.
myProcess.Start()
System.Threading.Thread.Sleep(1000)
Dim myProcessModule As ProcessModule
' Get all the modules associated with 'myProcess'.
Dim myProcessModuleCollection As ProcessModuleCollection = myProcess.Modules
Console.WriteLine("Properties of the modules associated " + _
"with 'notepad' are:")
' Display the properties of each of the modules.
Dim i As Integer
For i = 0 To myProcessModuleCollection.Count - 1
myProcessModule = myProcessModuleCollection(i)
Console.WriteLine("The moduleName is " + myProcessModule.ModuleName)
Console.WriteLine("The " + myProcessModule.ModuleName.ToString() + _
"'s base address is: " + myProcessModule.BaseAddress.ToString())
Console.WriteLine("The " + myProcessModule.ModuleName.ToString() + _
"'s Entry point address is: " + myProcessModule.EntryPointAddress.ToString())
Console.WriteLine("The " + myProcessModule.ModuleName + _
"'s File name is: " + myProcessModule.FileName)
Next i
' Get the main module associated with 'myProcess'.
myProcessModule = myProcess.MainModule
' Display the properties of the main module.
Console.WriteLine("The process's main moduleName is: " + myProcessModule.ModuleName)
Console.WriteLine("The process's main module's base address is: " + _
myProcessModule.BaseAddress.ToString())
Console.WriteLine("The process's main module's Entry point address is: " + _
myProcessModule.EntryPointAddress.ToString())
Console.WriteLine("The process's main module's File name is: " + _
myProcessModule.FileName)
myProcess.CloseMainWindow()
Process myProcess = new Process();
// Get the process start information of notepad.
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("notepad.exe");
// Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object.
myProcess.StartInfo = myProcessStartInfo;
// Create a notepad.
myProcess.Start();
System.Threading.Thread.Sleep(1000);
ProcessModule myProcessModule;
// Get all the modules associated with 'myProcess'.
ProcessModuleCollection myProcessModuleCollection = myProcess.Modules;
Console.WriteLine("Properties of the modules associated "
+"with 'notepad' are:");
// Display the properties of each of the modules.
for( int i=0;i<myProcessModuleCollection.Count;i++)
{
myProcessModule = myProcessModuleCollection[i];
Console.WriteLine("The moduleName is "
+myProcessModule.ModuleName);
Console.WriteLine("The " +myProcessModule.ModuleName + "'s base address is: "
+myProcessModule.BaseAddress);
Console.WriteLine("The " +myProcessModule.ModuleName + "'s Entry point address is: "
+myProcessModule.EntryPointAddress);
Console.WriteLine("The " +myProcessModule.ModuleName + "'s File name is: "
+myProcessModule.FileName);
}
// Get the main module associated with 'myProcess'.
myProcessModule = myProcess.MainModule;
// Display the properties of the main module.
Console.WriteLine("The process's main moduleName is: "
+myProcessModule.ModuleName);
Console.WriteLine("The process's main module's base address is: "
+myProcessModule.BaseAddress);
Console.WriteLine("The process's main module's Entry point address is: "
+myProcessModule.EntryPointAddress);
Console.WriteLine("The process's main module's File name is: "
+myProcessModule.FileName);
myProcess.CloseMainWindow();
Process^ myProcess = gcnew Process;
// Get the process start information of notepad.
ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" );
// Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*.
myProcess->StartInfo = myProcessStartInfo;
// Create a notepad.
myProcess->Start();
System::Threading::Thread::Sleep( 1000 );
ProcessModule^ myProcessModule;
// Get all the modules associated with 'myProcess'.
ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules;
Console::WriteLine( "Properties of the modules associated with 'notepad' are:" );
// Display the properties of each of the modules.
for ( int i = 0; i < myProcessModuleCollection->Count; i++ )
{
myProcessModule = myProcessModuleCollection[ i ];
Console::WriteLine( "The moduleName is {0}", myProcessModule->ModuleName );
Console::WriteLine( "The {0}'s base address is: {1}", myProcessModule->ModuleName, myProcessModule->BaseAddress );
Console::WriteLine( "The {0}'s Entry point address is: {1}", myProcessModule->ModuleName, myProcessModule->EntryPointAddress );
Console::WriteLine( "The {0}'s File name is: {1}", myProcessModule->ModuleName, myProcessModule->FileName );
}
myProcessModule = myProcess->MainModule;
// Display the properties of the main module.
Console::WriteLine( "The process's main moduleName is: {0}", myProcessModule->ModuleName );
Console::WriteLine( "The process's main module's base address is: {0}", myProcessModule->BaseAddress );
Console::WriteLine( "The process's main module's Entry point address is: {0}", myProcessModule->EntryPointAddress );
Console::WriteLine( "The process's main module's File name is: {0}", myProcessModule->FileName );
myProcess->CloseMainWindow();
継承階層
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Diagnostics.ProcessModule
スレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 2.0、1.1、1.0