本文整理汇总了VB.NET中System.Management.ManagementClass.GetInstances方法的典型用法代码示例。如果您正苦于以下问题:VB.NET ManagementClass.GetInstances方法的具体用法?VB.NET ManagementClass.GetInstances怎么用?VB.NET ManagementClass.GetInstances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了ManagementClass.GetInstances方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: Sample
' 导入命名空间
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
Dim c As New ManagementClass("Win32_Process")
Dim o As ManagementObject
For Each o In c.GetInstances()
Console.WriteLine( _
"Next instance of Win32_Process : {0}", o("Name"))
Next o
End Function
End Class
开发者ID:VB.NET开发者,项目名称:System.Management,代码行数:17,代码来源:ManagementClass.GetInstances
示例2: Sample
' 导入命名空间
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
Dim opt As New EnumerationOptions
' Will enumerate instances of the given class and any subclasses.
opt.EnumerateDeep = True
Dim mngmtClass As New ManagementClass("CIM_Service")
Dim o As ManagementObject
For Each o In mngmtClass.GetInstances(opt)
Console.WriteLine(o("Name"))
Next o
End Function
End Class
开发者ID:VB.NET开发者,项目名称:System.Management,代码行数:19,代码来源:ManagementClass.GetInstances
示例3: AsyncGetExample
' 导入命名空间
Imports System.Management
Public Class AsyncGetExample
Public Sub New()
Dim c As New ManagementClass("Win32_Process")
Dim ob As New ManagementOperationObserver
AddHandler ob.ObjectReady, AddressOf Me.NewObject
AddHandler ob.Completed, AddressOf Me.Done
c.GetInstances(ob)
While Not Me.Completed
System.Threading.Thread.Sleep(1000)
End While
'Here you can use the object
End Sub
Private finished As Boolean = False
Private Sub NewObject(ByVal sender As Object, _
ByVal e As ObjectReadyEventArgs)
Console.WriteLine("New result arrived: {0}", _
e.NewObject("Name"))
End Sub
Private Sub Done(ByVal sender As Object, _
ByVal e As CompletedEventArgs)
Console.WriteLine("async Get completed !")
finished = True
End Sub
Private ReadOnly Property Completed() As Boolean
Get
Return finished
End Get
End Property
Public Shared Function Main(ByVal args() _
As String) As Integer
Dim asyncGet As New AsyncGetExample
Return 0
End Function
End Class
开发者ID:VB.NET开发者,项目名称:System.Management,代码行数:53,代码来源:ManagementClass.GetInstances
注:本文中的System.Management.ManagementClass.GetInstances方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论