本文整理匯總了VB.NET中System.Management.WqlEventQuery.WqlEventQuery構造函數的典型用法代碼示例。如果您正苦於以下問題:VB.NET WqlEventQuery構造函數的具體用法?VB.NET WqlEventQuery怎麽用?VB.NET WqlEventQuery使用的例子?那麽, 這裏精選的構造函數代碼示例或許可以為您提供幫助。
在下文中一共展示了WqlEventQuery構造函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: EventSample
' 導入命名空間
Imports System.Management
Public Class EventSample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
'' Full query string specified to the constructor
Dim q As New WqlEventQuery( _
"SELECT * FROM Win32_ComputerShutdownEvent ")
' Only relevant event class name specified to the constructor
' Results in the same query as above
Dim query As New WqlEventQuery("Win32_ComputerShutdownEvent ")
MessageBox.Show(query.QueryString)
End Function 'Main
End Class
示例2: EventSample
' 導入命名空間
Imports System.Management
Public Class EventSample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Requests all instance creation events,
' with a specified latency of
' 10 seconds. The query created
' is "SELECT * FROM __InstanceCreationEvent WITHIN 10"
Dim t As New TimeSpan(0, 0, 10)
Dim q As New WqlEventQuery("__InstanceCreationEvent", t)
MessageBox.Show(q.QueryString)
End Function 'Main
End Class
示例3: EventSample
' 導入命名空間
Imports System.Management
Public Class EventSample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Requests notification of the creation
' of Win32_Service instances with a 10 second
' allowed latency.
Dim t As New TimeSpan(0, 0, 10)
Dim q As New WqlEventQuery("__InstanceCreationEvent", _
t, "TargetInstance isa ""Win32_Service""")
MessageBox.Show(q.QueryString)
End Function 'Main
End Class
示例4: EventSample
' 導入命名空間
Imports System.Management
Public Class EventSample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Requests sending aggregated events
' if the number of events exceeds 15.
Dim props() As String = {"TargetInstance.SourceName"}
Dim t As New TimeSpan(0, 10, 0)
Dim q As New WqlEventQuery("__InstanceCreationEvent", _
System.TimeSpan.MaxValue, _
"TargetInstance isa ""Win32_NTLogEvent""", _
t, _
props, _
"NumberOfEvents >15")
MessageBox.Show(q.QueryString)
End Function 'Main
End Class