Home > Software engineering >  Vb how to click on the ignore button
Vb how to click on the ignore button

Time:09-19








Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal HWND As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam) As Long As Long

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Private Const WM_LBUTTONUP=& amp; H202
Private Const WM_MBUTTONDBLCLK=& amp; H209

Private Declare Function SetForegroundWindow Lib "user32" (ByVal HWND) As Long As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal HWND As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const WM_KEYDOWN=& amp; H100

Private Sub Command1_Click ()

HPWND=FindWindow (vbNullString, "the view")
The Debug. Print "HPWD:" & amp; HPWND
HCWND=FindWindowEx (HPWND, 0, vbNullString, "ignore (I)")
The Debug. Print "HCWND:" & amp; HCWND
The SetForegroundWindow HPWND
'SendMessage HCWND WM_LBUTTONDOWN, 0, 0
'SendMessage HCWND WM_LBUTTONUP, 0, 0

Retval1=PostMessage (HPWND WM_KEYDOWN, VK_A, 0 & amp;) 'send this window closing information
The Debug. Print retval1



End Sub

Private Sub Command2_Click ()
Const WM_CLOSE=& amp; H10 'common variable definition


'program code
Dim winHwnd As Long 'a Long plastic variables winHwnd
Dim RetVal As Long 'a Long plastic variables RetVal
WinHwnd=FindWindow (vbNullString, "the view") 'API function to find the window "Calculator"
Debug. Print winHwnd 'shows the window handle
If winHwnd & lt;> If not 0 Then '0, said find window
RetVal=PostMessage (winHwnd WM_CLOSE, 0 & amp; , 0 & amp;) 'send this window closing information
If RetVal=0 Then 'If return information for 0. Said failure, not send success
MsgBox "Error Posting a message." 'prompt send failure
End the If
The Else
MsgBox "The Calculator is not open." 'tips found no open program
End the If



End Sub


This programming is shut out, the great god

CodePudding user response:

http://www.autohotkey.com

CodePudding user response:

Should find
Ignore (& amp; I)
  •  Tags:  
  • API
  • Related