EventWatcherOptions.BlockSize プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > EventWatcherOptions.BlockSize プロパティの意味・解説 

EventWatcherOptions.BlockSize プロパティ

ブロック操作ブロック サイズ取得または設定しますイベント待機する場合、この値は制御を戻す前に待機するイベント数を指定します

名前空間: System.Management
アセンブリ: System.Management (system.management.dll 内)
構文構文

Dim instance As EventWatcherOptions
Dim value As Integer

value = instance.BlockSize

instance.BlockSize = value
public int BlockSize { get;
 set; }
public:
property int BlockSize {
    int get ();
    void set (int value);
}
/** @property */
public int get_BlockSize ()

/** @property */
public void set_BlockSize (int
 value)
public function get BlockSize
 () : int

public function set BlockSize
 (value : int)

プロパティ
操作ブロックブロック サイズを示す Int32 値を返します

解説解説
使用例使用例

イベント クラス__InstanceCreationEvent であるために、Win32_Processインスタンス作成されたときにクライアント通知受信するしくみを説明する例を次に示します詳細については、MSDN ライブラリ (http://msdn.microsoft.com/library/ja) で Windows Management Instrumentation に関するドキュメント参照してくださいクライアントは WaitForNextEvent メソッド呼び出してイベント同期的受信します。この例は、コード例実行中にメモ帳などのプロセス開始することでテストできます

Imports System
Imports System.Management

' This example shows synchronous consumption of events. 
' The client is blocked while waiting for events. 

Public Class EventWatcherPolling
    Public Overloads Shared
 Function _
        Main(ByVal args() As String)
 As Integer

        ' Create event query to be notified within 1 second of 
        ' a change in a service
        Dim query As String
        query = "SELECT * FROM" & _
            " __InstanceCreationEvent WITHIN 1 " &
 _
            "WHERE TargetInstance isa ""Win32_Process"""

        ' Event options
        Dim eventOptions As New
 EventWatcherOptions
        eventOptions.Timeout = System.TimeSpan.MaxValue
        ' return after 1 event is received
        eventOptions.BlockSize = 1


        ' Initialize an event watcher and subscribe to events 
        ' that match this query
        Dim watcher As New
 ManagementEventWatcher( _
            "root\CIMV2", query, eventOptions)

        ' Block until the next event occurs 
        ' Note: this can be done in a loop
        ' if waiting for more than one occurrence
        Console.WriteLine( _
          "Open an application (notepad.exe) to trigger an event.")
        Dim e As ManagementBaseObject = _
            watcher.WaitForNextEvent()

        'Display information from the event
        Console.WriteLine( _
            "Process {0} has created, path is: {1}",
 _
            CType(e("TargetInstance"), _
                ManagementBaseObject)("Name"), _
            CType(e("TargetInstance"), _
                ManagementBaseObject)("ExecutablePath"))

        'Cancel the subscription
        watcher.Stop()
        Return 0

    End Function 'Main
End Class 'EventWatcherPolling
using System;
using System.Management;

// This example shows synchronous consumption of events. 
// The client is blocked while waiting for events. 

public class EventWatcherPolling 
{
    public static int Main(string[]
 args) 
    {
        // Create event query to be notified within 1 second of 
        // a change in a service
        string query = "SELECT * FROM" +
            " __InstanceCreationEvent WITHIN 1 " + 
            "WHERE TargetInstance isa \"Win32_Process\"";

        // Event options
        EventWatcherOptions eventOptions = new
            EventWatcherOptions();
        eventOptions.Timeout = System.TimeSpan.MaxValue;
        // return after 1 event is received
        eventOptions.BlockSize = 1;

        // Initialize an event watcher and subscribe to events 
        // that match this query
        ManagementEventWatcher watcher =
            new ManagementEventWatcher("root\\CIMV2",
 query,
            eventOptions);
      
        // Block until the next event occurs 
        // Note: this can be done in a loop if waiting for 
        //        more than one occurrence
        Console.WriteLine(
            "Open an application (notepad.exe) to trigger an event.");
        ManagementBaseObject e = watcher.WaitForNextEvent();

        //Display information from the event
        Console.WriteLine(
            "Process {0} has been created, path is: {1}", 
            ((ManagementBaseObject)e
            ["TargetInstance"])["Name"],
            ((ManagementBaseObject)e
            ["TargetInstance"])["ExecutablePath"]);

        //Cancel the subscription
        watcher.Stop();
        return 0;
    }
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EventWatcherOptions クラス
EventWatcherOptions メンバ
System.Management 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からEventWatcherOptions.BlockSize プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からEventWatcherOptions.BlockSize プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からEventWatcherOptions.BlockSize プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

EventWatcherOptions.BlockSize プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



EventWatcherOptions.BlockSize プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS