
编一个能够在指定时间之后自动关闭指定应用程序的程序
2个回答
展开全部
dim m as integer On Error GoTo Err Dim WMI Dim Obj Dim Objs CheckApplicationIsRun = False Set WMI = GetObject("WinMgmts:") Set Objs = WMI.InstancesOf("Win32_Process") For Each Obj In Objs If InStr(UCase(szExeFileName), UCase(Obj.Description)) <> 0 Then CheckApplicationIsRun = True If Not Objs Is Nothing Then Set Objs = Nothing If Not WMI Is Nothing Then Set WMI = Nothing Exit Function End If Next If Not Objs Is Nothing Then Set Objs = Nothing If Not WMI Is Nothing Then Set WMI = Nothing Exit Function Err: If Not Objs Is Nothing Then Set Objs = Nothing If Not WMI Is Nothing Then Set WMI = Nothing End Function Private Sub Timer1_Timer() '//timer1的interval属性设置为:1000 m=m+1 if m=3600 then If CheckApplicationIsRun("QQ.exe") = True Then '//检查QQ进程(QQ.exe) Shell "taskkill /im QQ.exe /f", vbHideElse End If end if End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询