求VB程序代码,定时关闭某(就用123.exe来表示吧)进程或程序.
1个回答
展开全部
窗口放一timer1
关键是这句IEDialogHwnd = FindWindow("ThunderRT6FormDC", "盛大魔界II 帐号注册机")
要用SKY++ 获得程序主窗口的类 和标题
当前程序 类为ThunderRT6FormDC 标题为盛大魔界II 帐号注册机
Timer1.Interval = 3000 表示3秒 定时器每三秒运行一次
将以下代码复制入
Option Explicit
'用于查找窗口的API
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const WM_CLOSE = &H10
Function CloseSystemConfirmDlg() As Boolean
Dim IEDialogHwnd As Long
Dim subHwnd As Long
Dim tempmsg As String
IEDialogHwnd = FindWindow("ThunderRT6FormDC", "盛大魔界II 帐号注册机")
DoEvents
If IEDialogHwnd Then
CloseSystemConfirmDlg = True
Call SendMessage(IEDialogHwnd, WM_CLOSE, 0, 0)
End If
End Function
Private Sub Form_Load()
Timer1.Interval = 3000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Call CloseSystemConfirmDlg
End Sub
关键是这句IEDialogHwnd = FindWindow("ThunderRT6FormDC", "盛大魔界II 帐号注册机")
要用SKY++ 获得程序主窗口的类 和标题
当前程序 类为ThunderRT6FormDC 标题为盛大魔界II 帐号注册机
Timer1.Interval = 3000 表示3秒 定时器每三秒运行一次
将以下代码复制入
Option Explicit
'用于查找窗口的API
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const WM_CLOSE = &H10
Function CloseSystemConfirmDlg() As Boolean
Dim IEDialogHwnd As Long
Dim subHwnd As Long
Dim tempmsg As String
IEDialogHwnd = FindWindow("ThunderRT6FormDC", "盛大魔界II 帐号注册机")
DoEvents
If IEDialogHwnd Then
CloseSystemConfirmDlg = True
Call SendMessage(IEDialogHwnd, WM_CLOSE, 0, 0)
End If
End Function
Private Sub Form_Load()
Timer1.Interval = 3000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Call CloseSystemConfirmDlg
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询