希望这里能成为我工作成长过程的积累。。
VbsSample(01)
上一篇 /
下一篇 2008-07-23 09:32:00
/ 个人分类:VbScript
'*********************************
'@funcname: ProcessExist
'@brief: 判定进程列表中是否有某个进程
'@param: sProcessName 进程名
'*********************************
Function ProcessExist(sProcessName)
Dim ws
ProcessExist = False
Set ws = Wscrīpt.CreateObject("wscrīpt.shell")
For each proc in GetObject("winmgmts:").instancesof("win32_process")
If UCase(proc.Name) = UCase(sProcessName) Then
ProcessExist = True
Exit For
End If
Next
Set ws = Nothing
End Function
'*********************************
'@funcname: SendKey
'@brief: 向系统发送键盘键
'@param: nKey 键盘按键
'*********************************
Function SendKey(nKey)
Dim oWshShell
Set ōWshShell =CreateObject("Wscrīpt.Shell")
oWshShell.SendKeys nKey
Wait(1)
Set ōWshShell = Nothing
End Function
'*********************************
'@funcname: ReadReg
'@brief:读取注册表的某一键值
'@param: sRegPath 注册表路径
'*********************************
Function ReadReg(sRegPath)
Dim oRegistry
Set ōRegistry = CreateObject("Wscrīpt.Shell")
ReadReg=oRegistry.RegRead(sRegPath)
Set ōRegistry = Nothing
End Function
收藏
举报
TAG:
VbScript