如何通过启用了Silverlight提升信任的浏览器外浏览器来查询您的计算机上是否正在运行某个进程?
答案 0 :(得分:2)
我认为这可以提供帮助
private void button1_Click(object sender, RoutedEventArgs e)
{
using (dynamic SWbemLocator = AutomationFactory.CreateObject("WbemScripting.SWbemLocator"))
{
SWbemLocator.Security_.ImpersonationLevel = 3;
SWbemLocator.Security_.AuthenticationLevel = 4;
dynamic IService = SWbemLocator.ConnectServer(".", @"root\cimv2");
dynamic QueryResults = IService.ExecQuery(@"SELECT * FROM Win32_Process");
dynamic t = QueryResults.Count;
for (int i = 0; i < t; i++)
{
dynamic p = QueryResults.ItemIndex(i);
MessageBox.Show(p.name );
}
}
}