2010-08-15 35 views

回答

1

的服务不按字母顺序返回。你需要对你的结果进行排序,否则你将不得不通过列表寻找它们。他们都在我的测试中。

我的示例代码:

ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_Service"); 
foreach (ManagementObject service in mos.Get()) 
{ 
    listBox1.Items.Add(service["DisplayName"]); 
} 
listBox1.Sorted = true; 
+0

谢谢。我注意到它并解决了问题,但忘记更新答案。 – Sung 2010-08-26 23:26:31

相关问题