返回列表 发帖

[原创] VBS+HTA版进程管理程序

闲来无事,写了个小程序:进程管理器。
1、功能:列举进程、(ntsd强制)结束进程,标志用户进程(区分系统进程),标志非C盘进程文件,支持在线查询进程说明(向百度提交关键词),可以打开进程所在文件夹并选择该文件。
2、应用范围:当资源管理器被病毒禁用时。

3、程序运行界面:
[attach]1584[/attach]

4、程序下载:
[attach]563[/attach]

5、源代码:
<!--////////程序说明/////////====
Intro  进程管理器:获取进程信息,支持网络查询,支持强制结束进程
FileName 进程管理器
Author  2laoshi
Version  ver1.0
Web  http://www.2laoshi.cn
MadeTime 2008-11-6~2008-11-7
<!--//////////设置hta格式////////////-->
<HTA:APPLICATION
SCROLL="no"
MaximizeButton="no"
MinimizeButton="no"
INNERBORDER="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
BORDER="thin"
/>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--//////////样式////////////-->
<style type="text/css">
a:link {color:blue}
a:visited {color: blue}
body  {background: #EEEEEE}
hr {width:90%;height:1px;margin:-5;color:#ccc}
p {font-size:12;margin:-2 5 2 5;}
fieldset {border :1px solid #BEBEBE;font-family:宋体;}
legend {color:red;font-size:14px}
#toper{text-align=center;font-size:13px;font-family: "隶书";color:darkblue;padding:1px;line-height:15px;background-color:white;width:250;align:center;margin:2 0 -5 100;}
#content{border:1px solid #ccc;height:360;width:390;margin:3;float:left}
#rightbox1{border:1px solid #ccc;height:219;width:135;margin:3;float:left;}
#rightbox2{border:1px solid #ccc;height:135;width:135;margin:3;float:left;}
#footer{border:1px solid #ccc;height:40;width:540;margin:0 5;}
#Ttable TD{text-align=center;background-color:#006699;font-size:13px;height:18;
         font-family: "隶书";color:#F2F3F7;padding:2px;line-height:18px;font:bold;}
#MyTable Td{background-color:#ccd2de;font-size:12px;padding-top:1px;height:20px;padding-left:4}
.row2{background-color:#ccd2ad;font-size:12px;padding-top:1px;height:20px;padding-left:4}
.div_button{text-align:center;width:100%;border:1px solid #ccc;
          background-color:#EEEEEE;font-size:12px;color:#333333;
          padding:3px 2px;margin:2px;line-height:20px;}
.button {padding:1px;text-align:center;border:0;background-color:#eee;height:23px;cursor:hand;}
.div_class{WIDTH:100%; HEIGHT:332; BACKGROUND-COLOR: transparent; overflow-y: scroll; scrollbar-shadow-color: #ffffff; scrollbar-highlight-color: #ffffff; scrollbar-face-color: #d9d9d9; scrollbar-3dlight-color: #d9d9d9; scrollbar-darkshadow-color: #d9d9d9; scrollbar-track-color: #ffffff; scrollbar-arrow-color: #ffffff;}
</style>
<!--//////////函数区////////////-->
<script language="vbscript">
ON ERROR RESUME NEXT
URL="http://www.baidu.com/s?wd="
set objWMIS=GetObject("winmgmts:\\.")
set fso=CreateObject("Scripting.FileSystemObject")
set wsh=CreateObject("Wscript.Shell")
Sub Window_onLoad
window.resizeTo 550,420
ileft=(window.screen.width-550)/2
itop=(window.screen.height-445)/2      
window.moveTo ileft,itop
GetProcList()               
End Sub
Sub Window_onUnLoad
set fso=nothing
set wsh=nothing            
End Sub
'添加表格行;
Function addRow(str1,str2,str3,flag,flag2)
set newrow=MyTable.insertRow()
set newcell=newrow.insertCell()
newcell.innerHTML=str1
set newcell=newrow.insertCell()
newcell.innerHTML=str2
if flag=1 then newcell.style.backgroundcolor="#ccd2ad"
set newcell=newrow.insertCell()
newcell.ondblclick=getRef("OpenFolder")
newcell.style.cursor="hand"
if flag2=1 then newcell.style.backgroundcolor="#acd2ad"
newcell.innerHTML=str3
End Function
'获取进程列表
Function GetProcList()
for i =1 to MyTable.rows.length-1
MyTable.deleteRow()
next
set ColProc=objWMIS.InstancesOf("Win32_Process")
for each objProc in ColProc
flag2=0
Pname=objProc.name
PID=objProc.ProcessID
Ppath=objProc.ExecutablePath
if isNull(Ppath) then
  Ppath=""
else
  if lcase(fso.getfile(Ppath).drive)<>"c:" then flag2=1
end if
colProperties=objProc.GetOwner(strNameOfUser,strUserDomain)
Puser=Lcase(strNameOfUser)
select case Puser
  case "system" Puser="系统进程"
  case "local service" Puser="本地服务"
  case "network service" Puser="网络服务"
  case else Puser="用户进程"
end select
str1="<input type=checkbox id="&PID&">"
str2="<a title="&Puser&"。点击到百度查看详细说明 href="&URL&Pname&">"&Pname&"</a>"
str3="<a title=双击打开文件夹>"&Ppath&"</a>"
if lcase(Pname)<>"system idle process" then
  if Puser="用户进程" then
    addRow str1,str2,str3,1,flag2
  else
   addRow str1,str2,str3,2,flag2
  end if
end if
next
End Function
'打开文件夹,并选择指定文件;
Function OpenFolder()
wsh.run "Explorer.exe /select,"&me.innertext
End Function
Function KillProc()
for i=1 to MyTable.rows.length-1
if MyTable.rows(i).cells(0).children(0).checked=true then
  PIDArr=PIDArr&MyTable.rows(i).cells(0).children(0).id&","
end if
next
if PIDArr then
PIDArr=left(PIDArr,(len(PIDArr)-1))
else
exit function
end if
PIDArr=split(PIDArr,",")
set ColProc=objWMIS.InstancesOf("Win32_Process")
for each objProc in ColProc
PID=objProc.ProcessID
for i=0 to UBound(PIDArr)
  if PID=int(PIDArr(i)) then
   objProc.terminate
   set objindex=document.getelementbyid(PIDArr(i))
   index=objindex.parentelement.parentelement.rowindex
   MyTable.deleteRow(index)
  end if  
next
next
End Function
Function KillProc2()
for i=1 to MyTable.rows.length-1
if MyTable.rows(i).cells(0).children(0).checked=true then
  id=MyTable.rows(i).cells(0).children(0).id
  wsh.run "ntsd -c q -p "&id,0
  MyTable.deleteRow(i)
end if
next
End Function
</script>
<!--//////////版面设计区////////////-->
<title>进程管理器</title>
<body topmargin="2" rightmargin="0" leftmargin="0" oncontextmenu=self.event.returnvalue=false>
<div id=toper>进程管理器processorManager(ver1.0)</div>
<div id=content>
<TABLE id="Ttable" cellSpacing=1 cellPadding=0 width=100%>
<TR>
<TD width=40>全选</TD>
<TD width=120>进程名</TD>
<TD width=300>进程所在</TD>
<TD width=13></TD></Tr>
</TABLE>
<div class="div_class">
<TABLE id="mytable" cellSpacing=1 cellPadding=0 width=100% style="margin-top:-22">
<TR title="这一行只是演示,所有数据不保存">
<TD width=32><input type=checkbox></TD>
<TD width=45>1000000000000000</TD>
<TD width=243>cccccccccccccccccccccccccccccccccccc</TD>
</TABLE>
</div>
</div>
<div id=rightbox1>
<p align=center style="margin-top:5;">程序简介
<hr>
<p style="color:red;">程序功能:
<p>列举、结束、强制结束、在线查询进程;获取进程文件所在路径;
<hr>
<p style="color:red;">程序运行:
<p>基于hta+vbs编写,需WSH支持;XP下测试通过。
<hr>
<p style="color:red;">作者信息:
<p><a href="http://www.2laoshi.cn" title="访问作者博客">2laoshi(youxi01)</a>
</div>
<div id=rightbox2>
<div class="div_button">
<input type=submit value="更新列表" class="button" onclick=GetProcList></div>
<div class="div_button">
<input type=submit value="结束进程" class="button" onclick=killProc></div>
<div class="div_button">
<input type=submit value="强制结束" class="button" onclick=KillProc2></div>
<div class="div_button">
<input type=submit value="退出程序" class="button" onclick=self.close></div>
</div>COPY
2

评分人数

闲来无事

写写vbs教程吧!

TOP

回复 2楼 的帖子

惭愧,惭愧...

不过要写vbs教程,真是觉得无从下手,水平不够...

TOP

太谦虚了,大家一起进步啊,我写教程的时候就是这么想的

TOP

支持rat版主!!!同时支持楼主!!!
有你的付出才有我们的进步!!

TOP

楼主您好 ....

小弟非常羨慕樓主可以vbs制成一个小程序

不知道是否有其他资源  可以学如何制作这种版快的教程

TOP

偶非常你写的BAT教程,如果你再来点入门的VBS那就更好了。

TOP

看了楼主的帖子
觉得你很厉害
楼主什么时候出教程
我一定拜读

TOP

62124528    VBS 自学者交流群, 大家有时间可以在一起聊一下

TOP

多学习学习,看一看 谢谢

TOP

返回列表