| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 802 人关注过本帖
标题:[求助]关于vbs
取消只看楼主 加入收藏
qq驴
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-3-11
收藏
 问题点数:0 回复次数:1 
[求助]关于vbs

List.ColumnHeaders.Clear
List.ListItems.Clear
List.View=3
List.GridLines=true
List.FullRowSelect=true
List.MultiSelect=false
List.GridLines=true
List.BackColor=&HF7EFE5
List.ForeColor=&H811E07
List.LabelEdit=false

With List.ColumnHeaders
.Add ,,"服务名称"
.Add ,,"显示名称"
.Add ,,"启动类型"
.Add ,,"运行状态"
.Add ,,"当前状态"
.Add ,,"服务类型"
.Add ,,"登录身份"
.Add ,,"服务描述"
.Add ,,"文件路径及参数"
End With
GetSystemServices

Function GetSystemServices()
On Error Resume Next '错误跳过

Dim sa, objService, objComputer,itm

Set objComputer = GetObject("WinNT://.")
Set sa = CreateObject("Shell.Application")
objComputer.Filter = Array("Service")

For Each objService In objComputer
set itm=List.ListItems.Add(,,objService.Name)
itm.SubItems(1)=objService.DisplayName
itm.SubItems(2)=GetStartType(objService.StartType)
itm.SubItems(3)=sa.IsServiceRunning(objService.Name)
itm.SubItems(4)=objService.Status
itm.SubItems(5)=objService.ServiceType
itm.SubItems(6)=objService.ServiceAccountName
itm.SubItems(7)=GetServiceDsc(objService.Name)
itm.SubItems(8)=objService.Path
Next

Set sa = Nothing
End Function

Function GetStartType(num)
Select Case num
Case 2
GetStartType = "自动"
Case 3
GetStartType = "手动"
Case 4
GetStartType = "已禁用"
End Select
End Function

Function GetServiceDsc(strService)
On Error Resume Next
Dim ws
Set ws = CreateObject("WScript.Shell")
GetServiceDsc = ws.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\" & strService & "\Description")
Set ws = Nothing
End Function

Private Sub List_ColumnClick(ch)
List.SortKey=ch.Index-1
List.Sorted=true
End Sub

Private Sub List_DblClick()
Dim nItems,nSel,i,strInfo
nSel=-1
nItems=List.ListItems.Count
For i=1 To nItems
If List.ListItems.Item(i).Selected=true Then
nSel=i
Exit For
End If
Next

If nSel=-1 Then
Exit Sub
End If

With List.ListItems.Item(i)
str="服务名称:" & .Text & vbCrLf
str=str & "显示名称:" & .SubItems(1) & vbCrLf
str=str & "启动类型:" & .SubItems(2) & vbCrLf
str=str & "运行状态:" & .SubItems(3) & vbCrLf
str=str & "当前状态:" & .SubItems(4) & vbCrLf
str=str & "服务类型:" & .SubItems(5) & vbCrLf
str=str & "登录身份:" & .SubItems(6) & vbCrLf
str=str & "服务描述:" & .SubItems(7) & vbCrLf
Str=str & "文件路径及参数:" & .SubItems(8) & vbCrLf
End With
MsgBox Str,,"服务信息(" & List.ListItems.Item(i).Text & ")"
End Sub



谁能给我解释讲解下~~~~~

搜索更多相关主题的帖子: vbs 
2006-04-10 12:08
qq驴
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-3-11
收藏
得分:0 

怎么没有人帮忙啊??

2006-04-11 21:20
快速回复:[求助]关于vbs
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017043 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved