InvokeMethodOptions クラス
管理メソッドを呼び出すためのオプションを指定します。
この型のすべてのメンバの一覧については、InvokeMethodOptions メンバ を参照してください。
System.Object
System.Management.ManagementOptions
System.Management.InvokeMethodOptions
Public Class InvokeMethodOptions
Inherits ManagementOptions
[C#]
public class InvokeMethodOptions : ManagementOptions
[C++]
public __gc class InvokeMethodOptions : public ManagementOptions
[JScript]
public class InvokeMethodOptions extends ManagementOptions
スレッドセーフ
この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。
使用例
using System;
using System.Management;
// This example demonstrates how to stop a system service.
class Sample_InvokeMethodOptions
{
public static int Main(string[] args) {
ManagementObject service =
new ManagementObject("win32_service=\"winmgmt\"");
InvokeMethodOptions options = new InvokeMethodOptions();
options.Timeout = new TimeSpan(0,0,0,5);
ManagementBaseObject outParams = service.InvokeMethod("StopService", null, options);
Console.WriteLine("Return Status = " + outParams["ReturnValue"]);
return 0;
}
}
[Visual Basic]
Imports System
Imports System.Management
' This sample demonstrates how to stop a system service.
Class Sample_InvokeMethodOptions
Overloads Public Shared Function Main(args() As String) As Integer
Dim service As New ManagementObject("win32_service=""winmgmt""")
Dim options As New InvokeMethodOptions()
options.Timeout = New TimeSpan(0, 0, 0, 5)
Dim outParams As ManagementBaseObject = service.InvokeMethod( _
"StopService", _
Nothing, _
options)
Console.WriteLine("Return Status = " & _
outParams("ReturnValue").ToString())
Return 0
End Function
End Class
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.Management
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
アセンブリ: System.Management (System.Management.dll 内)