让vb该段监视进程代码隐藏在暗中??
这个试过了可以用!不过我想在暗中进行,这样写的,但怎么不起作用了。。。?还有希望加一个如果该进程被强制关闭,则游戏被关闭,(这个vb程序窗口是隐藏的)再问下一直监视是否很...
这个试过了可以用!不过我想在暗中进行,这样写的,但怎么不起作用了。。。?还有希望加一个如果该进程被强制关闭,则游戏被关闭,(这个vb程序窗口是隐藏的)
再问下一直监视是否很占系统资源?
原代码:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = False
Command1.Caption = "开始监控"
End Sub
Private Sub Timer1_Timer()
Dim l As Long
l = FindWindow(vbNullString, "Diablo II")
If l = 0 Then Name (App.Path & "\D2Fild.dll") As (App.Path & "\D2Fald.dll"): MsgBox "游戏程序已经关闭!已完成文件重命名!", vbInformation + vbOKOnly: End
End Sub
我改的,但是不能用。。求按照前面说的帮我改下。。。。
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim l As Long
l = FindWindow(vbNullString, "Diablo II")
If l = 0 Then Name (App.Path & "\D2Fild.dll") As (App.Path & "\D2Fald.dll"): MsgBox "游戏程序已经关闭!已完成文件重命名!", vbInformation + vbOKOnly:
End
End Sub 展开
再问下一直监视是否很占系统资源?
原代码:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = False
Command1.Caption = "开始监控"
End Sub
Private Sub Timer1_Timer()
Dim l As Long
l = FindWindow(vbNullString, "Diablo II")
If l = 0 Then Name (App.Path & "\D2Fild.dll") As (App.Path & "\D2Fald.dll"): MsgBox "游戏程序已经关闭!已完成文件重命名!", vbInformation + vbOKOnly: End
End Sub
我改的,但是不能用。。求按照前面说的帮我改下。。。。
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim l As Long
l = FindWindow(vbNullString, "Diablo II")
If l = 0 Then Name (App.Path & "\D2Fild.dll") As (App.Path & "\D2Fald.dll"): MsgBox "游戏程序已经关闭!已完成文件重命名!", vbInformation + vbOKOnly:
End
End Sub 展开
1个回答
展开全部
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim l As Long
l = FindWindow(vbNullString, "Diablo II")
If l = 0 Then Name (App.Path & "\D2Fild.dll") As (App.Path & "\D2Fald.dll"): MsgBox "游戏程序已经关闭!已完成文件重命名!", vbInformation + vbOKOnly:End
End Sub
无需改动代码,只是将End指令放到冒号之后就行了!像这样: " vbInformation + vbOKOnly:End " ,如果换行的话,END指令将在Timer第一个周期就会被执行而退出程序了!当然就不会起作用了!
如果希望加一个该进程被强制关闭,则游戏被关闭的功能的话,那就需要使用到挂钩程序技术!单程序是做不到自己的进程被终止了,还去关闭游戏进程的!
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim l As Long
l = FindWindow(vbNullString, "Diablo II")
If l = 0 Then Name (App.Path & "\D2Fild.dll") As (App.Path & "\D2Fald.dll"): MsgBox "游戏程序已经关闭!已完成文件重命名!", vbInformation + vbOKOnly:End
End Sub
无需改动代码,只是将End指令放到冒号之后就行了!像这样: " vbInformation + vbOKOnly:End " ,如果换行的话,END指令将在Timer第一个周期就会被执行而退出程序了!当然就不会起作用了!
如果希望加一个该进程被强制关闭,则游戏被关闭的功能的话,那就需要使用到挂钩程序技术!单程序是做不到自己的进程被终止了,还去关闭游戏进程的!
更多追问追答
追问
那能不能加一个提示“如果强制关闭该程序,文件将损坏,你确定要关闭吗?”
这样强制结束进程还会有这个提示吧?
追答
一样不行,结束进程是强制结束程序。被结束的进程根本就执行不到有提示代码那块,还是需要用到挂钩程序技术!
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询