ProcessModule クラス

定義

特定のプロセスに読み込まれる.dllまたは.exeファイルを表します。

public ref class ProcessModule : System::ComponentModel::Component
public ref class ProcessModule
public class ProcessModule : System.ComponentModel.Component
public class ProcessModule
type ProcessModule = class
    inherit Component
type ProcessModule = class
Public Class ProcessModule
Inherits Component
Public Class ProcessModule
継承
継承
ProcessModule

次のコード サンプルは、ProcessModule クラスを使用して Notepad.exe アプリケーションで使用されるすべてのモジュールに関する情報を取得および表示する方法を示しています。

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();
using (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();
}
Using 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()
End Using

注釈

モジュールとは、実行可能ファイルまたはダイナミック リンク ライブラリ (DLL) です。 各プロセスは、1 つ以上のモジュールで構成されます。 このクラスを使用すると、モジュールに関する情報を取得できます。

重要

この型は IDisposable インターフェイスを実装します。 型の使用が完了したら、直接的または間接的に型を破棄する必要があります。 直接的に型を破棄するには、try/catch ブロック内で Dispose メソッドを呼び出します。 間接的に型を破棄するには、using (C# の場合) または Using (Visual Basic 言語) などの言語構成要素を使用します。 詳細については、IDisposable インターフェイスに関するトピック内の「IDisposable を実装するオブジェクトの使用」セクションを参照してください。

プロパティ

BaseAddress

モジュールが読み込まれたメモリ アドレスを取得します。

CanRaiseEvents

コンポーネントがイベントを発生させることがきるかどうかを示す値を取得します。

(継承元 Component)
Container

IContainer を含む Component を取得します。

(継承元 Component)
DesignMode

Component が現在デザイン モードかどうかを示す値を取得します。

(継承元 Component)
EntryPointAddress

システムがモジュールを読み込んで実行するときの関数のメモリ アドレスを取得します。

Events

Component に結び付けられているイベント ハンドラーのリストを取得します。

(継承元 Component)
FileName

モジュールの完全なパスを取得します。

FileVersionInfo

モジュールに関するバージョン情報を取得します。

ModuleMemorySize

モジュールを読み込むために必要なメモリの量を取得します。

ModuleName

プロセスのモジュール名を取得します。

Site

ComponentISite を取得または設定します。

(継承元 Component)

メソッド

CreateObjRef(Type)

リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。

(継承元 MarshalByRefObject)
Dispose()

Component によって使用されているすべてのリソースを解放します。

(継承元 Component)
Dispose(Boolean)

Component によって使用されているアンマネージド リソースを解放し、オプションでマネージド リソースも解放します。

(継承元 Component)
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetLifetimeService()
古い.

対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
GetService(Type)

Component またはその Container で提供されるサービスを表すオブジェクトを返します。

(継承元 Component)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
InitializeLifetimeService()
古い.

このインスタンスの有効期間ポリシーを制御する有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
MemberwiseClone(Boolean)

現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。

(継承元 MarshalByRefObject)
ToString()

モジュールの名前を文字列に変換します。

イベント

Disposed

Dispose() メソッドの呼び出しによってコンポーネントが破棄されるときに発生します。

(継承元 Component)

適用対象