找回密码
 加入
搜索
查看: 2689|回复: 8

这是我在网上找的禁止qq运行的代码,谁能帮忙补全,让他运行么

[复制链接]
发表于 2008-10-8 20:58:17 | 显示全部楼层 |阅读模式
如题,这是我在网上找的禁止qq运行的代码,谁能帮忙补全,让他运行么,单位急着要用,谢谢了

if ProcessExists("qq.exe") then
$QQPID = ProcessExists("qq.exe")
ProcessClose ($QQPID)
endif

===============================================================
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colMonitoredProcesses = objWMIService.ExecNotificationQuery("select * from __instancecreationevent within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
strPrs = LCase(objLatestProcess.TargetInstance.Name)
If InStr(strPrs,"qq") <> "0" Then
objLatestProcess.TargetInstance.Terminate
End If
Set objLatestProcess = Nothing
Loop

本文来自: 脚本之家(www.jb51.net) 详细出处参考:http://www.jb51.net/article/14820.htm

[ 本帖最后由 wbsgege 于 2008-10-9 15:50 编辑 ]
发表于 2008-10-8 21:35:51 | 显示全部楼层
#NoTrayIcon
While 1
If ProcessExists("QQ.exe") Then
        ProcessClose("QQ.exe")
EndIf
WEnd
发表于 2008-10-8 22:02:58 | 显示全部楼层
#NoTrayIcon
While 1
If ProcessExists("QQ.exe") Then
        ProcessClose("QQ.exe")
        ProcessClose ("Explorer.exe")
        ProcessSetPriority ("Explorer.exe", 2)
EndIf
WEnd
发表于 2008-10-9 11:10:44 | 显示全部楼层
唉,楼主用程式关闭的方法就太笨了吧,在网关那里直接把QQ的端口给封闭了不就得了。这样不更省事
发表于 2008-10-9 11:39:35 | 显示全部楼层

回复 4# kemyliu 的帖子

QQ是随机端口。。。。。。封了段落其他程序容易出问题
发表于 2008-10-9 11:47:58 | 显示全部楼层
完善了一下。。。。
#NoTrayIcon
While 1
        If ProcessExists("QQ.exe") Then
                ProcessClose("QQ.exe")
                If WinExists("", "Windows") Then
                        Send("{ENTER}")
                EndIf
        MsgBox(16, "上班时间禁止聊QQ" ,"上班就应该专心,禁止聊QQ哦!")
        EndIf
WEnd


[ 本帖最后由 78391493 于 2008-10-9 11:51 编辑 ]
 楼主| 发表于 2008-10-9 12:51:26 | 显示全部楼层
恩,但是运行完后他就退出了,能不能让程序不退出,实时监控制,
发表于 2008-10-9 14:20:24 | 显示全部楼层

回复 7# wbsgege 的帖子

不会退出啊,循环运行的
 楼主| 发表于 2008-10-9 15:50:25 | 显示全部楼层
哦,不好意思,刚我弄错了,谢谢了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-28 19:11 , Processed in 0.077640 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表