101 VB.NET Samples - How-To Service Manager

.Net Frame里如何获得SCM里的服务程序列表呢.这要用到System.ComponentModel.Component类.

具体成员变量和成员函数可以见MSDN里.

Dim svc As ServiceController
Dim svcs As ServiceController() = ServiceController.GetServices()

For Each svc In svcs
With Me.lvServices.Items.Add(svc.DisplayName)
.SubItems.Add(svc.Status.ToString())
.SubItems.Add(svc.ServiceType.ToString())
End With
mcolSvcs.Add(svc, svc.DisplayName)
Next svc

你可能感兴趣的:(.net,vb,VB.NET)