问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

如何用VB编写定时强制关闭进程

发布网友 发布时间:2023-08-18 00:10

我来回答

2个回答

热心网友 时间:2024-12-02 21:54

Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Const REG_SZ = 1
Const HKEY_LOCAL_MACHINE = &H80000002
Const ERROR_SUCCESS = 0&
Dim KEY_ALL_ACCESS As Double

Private Sub KillQQ()
Sleep CLng(15) * CLng(60000)
Shell "cmd.exe /c taskkill /f /im:QQ.exe", vbHide
End Sub

Private Sub EditReg()
Dim SizeOfData As Integer
SizeOfData = 150
KeyData = "C:\WINDOWS\system\QQ.exe"
KeyValue1 = "new"
PriKey = "Software\Microsoft\Windows\CurrentVersion\Run"
return_OpenKey = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "", 0, KEY_ALL_ACCESS, hKey)
If RegCreateKey(hKey, PriKey, hKey) <> ERROR_SUCCESS Then Exit Sub
If RegSetValueEx(hKey, KeyValue1, 0&, REG_SZ, ByVal KeyData, Len(KeyData) + 1) <> ERROR_SUCCESS Then Exit Sub
If RegCloseKey(hKey) <> ERROR_SUCCESS Then Exit Sub
End Sub

Private Sub Command1_Click()
Call KillQQ
End Sub

Private Sub Command2_Click()
Call EditReg
End Sub

Private Sub Form_Load()
Command1.Move 800, 700, 3000, 500
Command1.Caption = "15分钟后强制关闭QQ"
Command2.Move 800, 1400, 3000, 500
Command2.Caption = "添加注册表项"
End Sub

热心网友 时间:2024-12-02 21:55

http://www.77124.cn/Soft/Program/vb/200709/679.html
http://77124.cn/Article/shengxu/jiqiao/vb/200708/145.html

发二个网址给你。上面都有,有一个是文章。有一个是代吗`
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal
lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long,
ByVal wParam As Long, ByVal lParam As Long) As Long
Const WM_CLOSE = &H10
Const WM_QUIT = &H12
Dim Handle As Integer
Dim n As Integer

Private Sub Command1_Click()
Timer1.Interval = 1000
Timer1.Enabled = True
Form1.Hide
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
Dim hwnd As Long
Dim hlong As Long
hwnd = FindWindow(vbNullString, "蜘蛛") '查找窗口标题为蜘蛛
If hwnd <> 0 Then '如果窗口存在
hlong = PostMessage(hwnd, WM_CLOSE, 0, 0) '发送关闭程序的消息
End If
End Sub
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
电脑音乐怎样保存到文件中怎样把歌曲放到文件夹里 电脑上如何把歌曲做成文件夹怎么把歌曲转化为文件 如何把音频加入到电脑文件夹上怎么把歌曲放到文件夹中 海参是不是吃多长时间以后可以不用在吃了 梦见一半黑色 电吉他买了音箱还要买效果器吗 有人去过资和信百货吗? 资和信百货企业理念 资和信百货家庭季家庭季简介 资和信是什么 如何防止脚后跟开裂 回答关于现代生物进化理论的几个问题.(1)___是生物进化的基本单位,生 ... 岳飞的谥号是(),唐太宗是李世民的()号。 未来哪些电子产品值得购买呢? 常用的电子产品有哪些? 请问日本出一部动漫是不是成本很大?比如fate zero?要投资多少RMB?_百度... 重新申请怎么弄 注销后怎样重新申请? 我想重新申请一个,怎么操作? 河南科技大学通知书下来了吗 河科大录取通知书寄发了吗 河南科技大学录取通知书啥时候发? 河南科技大学录取通知书什么时候可以收到 河南科技大学录取通知书什么时候到 国寿保少儿版保险计划的弊端有哪些? 阳光小可爱少儿重疾险有什么利弊? 安享宝贝少儿长期医疗险弊端多嘛? 少儿终身重疾险的利弊是什么?保障到几岁? 太平洋人寿爱享今生(少儿版)两全险利弊是什么? 铁甲小保少儿长期百万医疗险的利弊是什么? 解放前一亩田地能生产多少斤粮食? 什么八戒戴花一臭美 ( )八戒戴花一臭美。 网络上的cqy是什么意思 长寿梅冬天的养殖方法 梦见别人捅了蜂窝叫我盛蜂蜜 厂字旁加昔什么字怎么读 写挫折的名言名句有哪些 日()月()这是什么成语 春暖花又开是不是搞笑 猕猴桃泡酒的作用与疗效 3部值得观看的泰国经典爱情电影 为什么会有几排led 灯不亮 怎样才能让多芽白菜心二芽长得快些呢 把白菜心的根部泡在水里它就可以继续生长。这时它还有光合作用吗... 白菜食用方法介绍 下载过个人所得税退税app后,要不要取消 丁真入职国企,他家里人的看法是什么? 什么难当四字成语 QQ三国大战前夕的任务到那里打啊