从百度知道看的,VB监视进程:
让VB程序监视进程中的名称“windows 任务管理器”,和“AAA”两个进程的进程名,
而且进行 *** 作:如果“windows 任务管理器”被关闭时则自动关闭“进程某某”程序!
可以用一个 Timer 定时执行下面的代码
Dim Handle As LongHandle = FinDWindow(vbnullstring,"windows 任务管理器")Dim Handle2 as longHandle2 = FinDWindow(vbnullstring,"进程某某")if not (Handle) then SendMessage Handle2,WM_CLOSE,0Option ExplicitPrivate Declare Function FinDWindow lib "user32" Alias "FinDWindowA" (ByVal lpClassname As String,ByVal lpWindowname As String) As LongPrivate Declare Function GetwindowThreadProcessID lib "user32" (ByVal hwnd As Long,lpDWProcessID As Long) As LongPrivate Declare Function TerminateProcess lib "kernel32" (ByVal hProcess As Long,ByVal uExitCode As Long) As LongPrivate Declare Function OpenProcess lib "kernel32" (ByVal DWDesiredAccess As Long,ByVal binheritHandle As Long,ByVal DWProcessID As Long) As LongPrivate Sub Timer1_Timer()Dim Handle As LongDim handle2 As LongDim ProHandle As LongDim ProcessHandle As LongHandle = FinDWindow(vbNullString,"windows 任务管理器")If Handle = 0 Then handle2 = FinDWindow(vbNullString,"进程某某") GetwindowThreadProcessID handle2,ProHandle ProcessHandle = OpenProcess(1,ProHandle) TerminateProcess ProcessHandle,0 End IfEnd Sub总结
以上是内存溢出为你收集整理的转载:VB监视进程全部内容,希望文章能够帮你解决转载:VB监视进程所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)