如何用c#遍历wince进程并终止指定进程
如何如何用c#遍历wince进程,并终止指定进程wmi只用过一点,wince支持wmi编程吗?具体代码发下...
如何如何用c#遍历wince进程,并终止指定进程
wmi只用过一点,wince支持wmi编程吗?具体代码发下 展开
wmi只用过一点,wince支持wmi编程吗?具体代码发下 展开
1个回答
展开全部
用WMI遍历...
Imports System
Imports System.Management
Imports System.Windows.Forms
Namespace VBdotNetExample
Public Class MyWMIQuery
Public Overloads Shared Function Main() As Integer
Try
Dim searcher As New ManagementObjectSearcher( _
"root\CIMV2", _
"SELECT * FROM Win32_Process")
For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("-----------------------------------")
Console.WriteLine("Win32_Process instance")
Console.WriteLine("-----------------------------------")
Console.WriteLine("ProcessId: {0}", queryObj("ProcessId"))
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
End Function
End Class
End Namespace
Imports System
Imports System.Management
Imports System.Windows.Forms
Namespace VBdotNetExample
Public Class MyWMIQuery
Public Overloads Shared Function Main() As Integer
Try
Dim searcher As New ManagementObjectSearcher( _
"root\CIMV2", _
"SELECT * FROM Win32_Process")
For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("-----------------------------------")
Console.WriteLine("Win32_Process instance")
Console.WriteLine("-----------------------------------")
Console.WriteLine("ProcessId: {0}", queryObj("ProcessId"))
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
End Function
End Class
End Namespace
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询