全局代码
<DllImport("user32.dll", EntryPoint := "FindWindow", SetLastError := True)> _
Public Function FindWindow(lpClassName As String, lpWindowName As String) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint := "FindWindowEx", SetLastError := True)> _
Public Function FindWindowEx(hwndParent As IntPtr, hwndChildAfter As UInteger, lpszClass As String, lpszWindow As String) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint := "SendMessage", SetLastError := True, CharSet := CharSet.Auto)> _
Public Function SendMessage(hwnd As IntPtr, wMsg As UInteger, wParam As IntPtr, lParam As Integer) As Integer
End Function
Public Sub CloseWin(winTitle As String, buttonTitle As String)
Dim hwnd As IntPtr = FindWindow(Nothing, winTitle)
If hwnd <> IntPtr.Zero Then
Dim hwndSure As IntPtr = FindWindowEx(hwnd, 0, "Button", buttonTitle)
If hwnd <> IntPtr.Zero Then
SendMessage(hwndSure, &Hf5, 0, 0)
'按她
End If
End If
End Sub
做个计划任务,不断执行下面代码
CloseWin("提示", "否(&N)")