- <!--////////程序说明/////////====
- 程序名称:系统进程控制程序
- 初期作品....
- 作者说明:youxi01,,,版权没有,欢迎盗版!!///////////-->
- <TITLE>程序设置</TITLE>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <HTA:APPLICATION
- ID="MyhyliApp"
- APPLICATIONNAME="设置程序"
- VERSION="1.0"
- SCROLL="no"
- INNERBORDER="no"
- CONTEXTMENU="no"
- CAPTION="yes"
- SHOWINTASKBAR="yes"
- SINGLEINSTANCE="yes"
- SYSMENU="yes"
- WINDOWSTATE="normal"
- NAVIGABLE="yes"
- />
- <script>
- <!--
- var curMenu=null;
-
- function initializeUI() {
- var i;
- for(i=0;i<document.all.tags('span').length;i++) {
- if(document.all.tags('span')[i].className=='menuUp') {
- document.all.tags('span')[i].attachEvent("onmouseover", onmenuOver);
- document.all.tags('span')[i].attachEvent("onmouseout", onmenuOut);
- document.all.tags('span')[i].attachEvent("onmousedown", onmenuDown);
- }
- }
- }
-
- function onmenuOver() {
- obj=event.srcElement;
-
- obj.className='menuOver';
-
- if(curMenu!=null && eval('sub'+curMenu.id+'.style.visibility=="visible"')) {
- curMenu.className='menuUp';
- obj.className='menuDown';
- eval('sub'+curMenu.id+'.style.visibility="hidden"');
- eval('sub'+obj.id+'.style.visibility="visible"');
- eval('sub'+obj.id+'.runtimeStyle.left=sub'+obj.id+'.style.left');
- eval('sub'+obj.id+'.runtimeStyle.top=sub'+obj.id+'.style.top');
- curMenu=obj;
- }
- }
- function hideMenu() {
-
- if(curMenu!=null && event.srcElement.tagName!='SPAN') {
- curMenu.className='menuUp';
- eval('sub'+curMenu.id+'.style.visibility="hidden"');
- curMenu=null;
- }
- }
-
- function onmenuOut() {
- obj=event.srcElement;
-
- if(eval('sub'+obj.id+'.style.visibility!="visible"')) {
- obj.className='menuUp';
- }
- }
-
- function onmenuDown() {
- obj=event.srcElement;
-
- if(curMenu!=null && curMenu!=obj) {
- obj.className='menuDown';
- eval('sub'+obj.id+'.style.visibility="visible"');
- eval('sub'+obj.id+'.runtimeStyle.left=sub'+obj.id+'.style.left');
- eval('sub'+obj.id+'.runtimeStyle.top=sub'+obj.id+'.style.top');
-
- curMenu.className='menuUp';
- eval('sub'+curMenu.id+'.style.visibility="hidden"');
- }
- else if(curMenu==obj) {
- if(obj.className!='menuDown') {
- obj.className='menuDown';
- eval('sub'+obj.id+'.style.visibility="visible"');
- eval('sub'+obj.id+'.runtimeStyle.left=sub'+obj.id+'.style.left');
- eval('sub'+obj.id+'.runtimeStyle.top=sub'+obj.id+'.style.top');
- }
- else {
- obj.className='menuUp';
- eval('sub'+obj.id+'.style.visibility="hidden"');
- }
- }
- else {
- obj.className='menuDown';
- eval('sub'+obj.id+'.style.visibility="visible"');
- eval('sub'+obj.id+'.runtimeStyle.left=sub'+obj.id+'.style.left');
- eval('sub'+obj.id+'.runtimeStyle.top=sub'+obj.id+'.style.top');
- }
- curMenu=obj;
-
- }
-
- function popupmenu() {
- curMenu=menu4;
- submenu4.runtimeStyle.pixelLeft=event.x;
- submenu4.runtimeStyle.pixelTop=event.y;
- submenu4.style.visibility='visible';
- }
-
- document.onclick=hideMenu;
- </script>
-
- <SCRIPT LANGUAGE="VBScript">
- dim owner(50),path(50),name(50),id(50),thread(50)
-
- Sub Window_onLoad
- initializeUI
- window.resizeTo 400,250
- window.moveTo 400,200
- End Sub
-
- sub getprocess()
- if process.options.length>1 then '如果原来已经有项目,则移除所有项目;'
- for i=1 to process.options.length
- process.options.remove(1)
- next
- end if
- i=1
- Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") '连接到WMI;'
- Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process")
- For each objProcess in colProcesses
- Set objOption = Document.createElement("OPTION") '添加option元素;'
- objOption.Text = objProcess.name
- objOption.Value = i
- process.Add(objOption) 'process列表框添加项目;'
- colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain) '获取用户;'
- name(i)=objProcess.Name '用数组储存程序名称;'
- id(i)=objProcess.ProcessID
- thread(i)=objProcess.ThreadCount
- owner(i)=strNameOfUser
- path(i)=objProcess.ExecutablePath
- i=i+1
- Next
- End sub
-
- sub getvalue()
- CurID=process.selectedindex
- read.value="进程名称:"&vbcrlf&name(CurID)&vbcrlf&"ID:"&id(CurID)&vbcrlf&"所有者:"&owner(CurID)
- read.value=read.value&vbcrlf & "线程数:"&vbcrlf&thread(CurID)&vbcrlf&"路径:"&vbcrlf&path(CurID)
- end sub
-
- sub killprocess() '停止进程'
- if process.selectedindex<1 then '如果没有选择进程,则退出函数;'
- exit sub
- end if
- prs=process.options(process.selectedindex).text '进程名称为列表框中选择名称;'
- Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
- Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process where name='"&prs&"'")
- For each objProcess in colProcesses
- objProcess.Terminate() '结束该进程。'
- next
- end sub
-
- sub about()
- txt="程序说明:"&vbcrlf&vbcrlf&"本程序基于以下技术开发"&vbcrlf&"-DHTML"&vbcrlf&"-HTML-Application"
- txt=txt&vbcrlf&"FileSystemObject(FSO)"&vbcrlf&vbcrlf&"系统要求"&vbcrlf&"Internet Explorer 5.5以上"
- txt=txt&vbcrlf&"WinXP/Win98/Win2000"&vbcrlf&vbcrlf &"2006-5-1"
- read.value=txt
- end sub
-
- sub delfile(s)
- CurID=process.selectedindex
- if process.options.length<=1 or CurID<1 then
- exit sub
- end if
- set fso=createobject("scripting.filesystemobject")
- objFile=path(CurID) '获取文件名,文件路径'
- set myFile=fso.getfile(objFile) '获得文件对象'
- if s="d" then
- remind=msgbox("将要删除文件:"&vbcrlf&myFile&vbcrlf&"您是否确定!",vbOKCancel+vbQuestion+vbDefaultButton2,"提醒消息")
- if remind=1 then
- killprocess()
- myFile.delete
- else
- exit sub
- end if
- else
- set myFolder=myFile.parentfolder '取文件所在的文件夹;'
- set objShell=createobject("wscript.shell")
- objShell.run(myFolder)
- end if
- end sub
- </SCRIPT>
- <STYLE>
- body {
- margin:0px;
- background-color:menu;
- }
- td,a,div,textarea {
- font-family:宋体;
- font-size:12px;
- }
- .submenu {
- border:2px outset buttonhighlight;
- background-color:menu;
- position:absolute;
- top: 21px;
- z-index:13;
- padding:1px;
- overflow:hidden;
- visibility: hidden;
- }
- a.menutext {
- width:100%;
- color:menutext;
- text-decoration:none;
- padding:2px;
- }
- a.menutext:hover {
- background-color:#CCCCCC;
- color:#0066CC;
- border-top-color: #000000;
- border-right-color: #000000;
- border-bottom-color: #000000;
- border-left-color: #000000;
- }
- .menuUp {
- margin:1px 0px;
- padding-top:3px;
- padding-left:8px;
- padding-right:8px;
- border:1px solid menu;
- cursor:default;
- height:20px;
- position:relative;
- overflow: hidden;
- visibility: visible;
- }
- .menuOver {
- margin:1px 0px;
- padding-top:3px;
- padding-left:8px;
- padding-right:8px;
- border-left:1px solid buttonhighlight;
- border-top:1px solid buttonhighlight;
- border-right:1px solid buttonshadow;
- border-bottom:1px solid buttonshadow;
- height:20px;
- position:relative;
- }
- .menuDown {
- padding-top:4px;
- padding-left:9px;
- padding-right:7px;
- cursor:default;
- height:20px;
- position:relative;
- margin-top: 1px;
- margin-right: 0px;
- margin-bottom: 1px;
- margin-left: 0px;
- border-top-width: 1px;
- border-right-width: 1px;
- border-bottom-width: 1px;
- border-left-width: 1px;
- border-top-style: solid;
- border-right-style: solid;
- border-bottom-style: solid;
- border-left-style: solid;
- border-top-color: buttonshadow;
- border-right-color: buttonhighlight;
- border-bottom-color: buttonhighlight;
- border-left-color: buttonshadow;
- }
- .separator {
- width:100%;
- margin:2px;
- margin-top:-4px;
- height:12px;
- overflow:hidden;
- }
- .grid {
- width:9px;
- height:9px;
- font-size:1px;
- line-height:1px;
- border:1px solid black;
- vertical-align:absmiddle;
- }
- .en {
- font-family:Tahoma;
- font-size:11px;
- }
- #readingarea {
- width:100%;
- height:100%;
- background-color:#C0C0C0;
- color:#000000;
- font-size:14px;
- line-height:18px;
- letter-spacing:1px;
- padding:10px;
- }
- #process {
- width:100%;
- font-size:14px;
- font-family:Arial;
- }
-
- </STYLE>
- </HEAD>
- <BODY>
- <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td id=menubar onselectstart="return false" colspan="1">
- <span class="menuUp" id=menu1>文件</span><span class="menuUp" id=menu2>其它</span><span class="menuUp" id=menu3>帮助</span>
- <div id="submenu4" class=submenu style="left: 140px; width:100px">
- <a class="menutext" href=# title="刷新进程" onClick="getprocess()"> 刷新进程</a>
- <a class="menutext" href=# title="结束进程" onClick="killprocess()"> 结束进程</a>
- <div class="separator">
- <hr>
- </div>
- <a class="menutext" href=# title="删除进程对应文件" onClick="delfile('d')"> 删除文件</a>
- <a class="menutext" href=# title="转到程序所在的文件夹" onClick="delfile('r')"> 转到文件</a>
- <div class="separator">
- <hr>
- </div>
- <a class="menutext" href=# title="关于" onClick="about()"> 关于软件</a> </div>
- <td><span class="menuUp" id=menu4></span></td>
- </tr>
- <tr>
- <td width="554" height="375" align="left" valign=top><textarea name="read" cols="" rows="" readonly wrap="virtual" id="readingarea" oncontextmenu="popupmenu()" > 系统进程管理
- 1、获取系统进程;
-
- 2、停止进程;
-
- 3、删除相关文件。</textarea></td>
- <td width=233 valign=top id=directory onselectstart="return false"><p>
- <select name="process" size=12 id=process onclick="getvalue()" ondblclick="killprocess()">
- <option selected>进程名称</option>
- </select>
- </p> </td>
- </tr>
- </table>
- <div id="submenu1" class=submenu style="left: 0px; width:120px">
- <a class="menutext" href="#" title="获取系统进程" onClick="getprocess()"> 获得进程</a>
- <a class="menutext" href=# title="停止系统进程" onClick="killprocess()"> 停止进程</a>
- <a class="menutext" href=# title="删除进程对应文件" onClick="delfile('d')"> 删除文件</a>
- <div class="separator"><hr></div>
- <a class="menutext" href=# onClick="window.close()" title="退出程序"> 关闭 </span></a>
- </div>
- <div id="submenu2" class=submenu style="left: 42px; width:120px">
- <a class="menutext" href=# title="课时安排查询"> 课时查询</a>
- <a class="menutext" href=# title="生日提醒"> 生日提醒</a>
- <div class="separator"><hr></div>
- <a class="menutext" href=# title="关闭计算机"> 关机</a>
- <a class="menutext" href=# title="重新启动计算机"> 重启</a>
- <a class="menutext" href=# title="注销"> 注销</a>
- </div>
- <div id="submenu3" class=submenu style="left: 84px; width:100px">
- <a class="menutext" href="mailto:pcl_83@163.com" title="联系作者"> 联系作者</a>
- <a class="menutext" href=# title="关于" onClick="about()"> 关于软件</a></div>
- </BODY>
- </HTML>
复制代码
|