hi all . i am trying to click save button on file download window using this code but for some reason it doesn't work. I know i got the correct handle of the button but problem is clicking it. Hope you guyes help me fix this problem.Thanks
Code: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_KEYDOWN = &H100 Private Const WM_KEYUP = &H101 Private Const VK_SPACE = &H20 Private Sub Command2_Click() Dim X As Long, editx As Long Dim button As Long X = FindWindow("#32770", "File Download") button = FindWindowEx(X, 0&, "button", "&Save") PostMessage button, WM_KEYDOWN, 32, 0 'send space to trigger button press PostMessage button, WM_KEYUP, 32, 0 End Sub




Reply With Quote