vb 关闭程序~~~

来源:百度知道 编辑:UC知道 时间:2024/06/14 18:58:28
vb
不介入命令提示符就关闭程序
最好加点注释

控件:Microsoft Common DIALOG Contral 的 :ListViwe

两个命令按钮:
一个时间控件
一个listviwe

'先复制此代码在最前
'======================用于查找进程和终止进程的API函数常数定义================ =====
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long