希望这里能成为我工作成长过程的积累。。

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

 

评分:0

我来说两句

日历

« 2024-04-28  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 8515
  • 日志数: 15
  • 建立时间: 2007-06-10
  • 更新时间: 2008-07-23

RSS订阅

Open Toolbar