title: Accessing buttons on the Internet Explorer 11 View downloads form
body: <p>I have a piece of code in vb.net to open a web link for an application and to download a file from the page. The web browser loads the page and the program auto clicks the link on the page to download the file which then makes the &quot;View Downloads - Internet Explorer&quot; window in IE 11 to pop up as shown below:</p>
  <p><a href="https://i.stack.imgur.com/qu1JU.png" rel="nofollow noreferrer">Internet Explorer 11- VIew Downloads window</a></p>
  <p>I managed to activate the window but not able to click the Save button to automatically download the file without user intervention. The code that I tried to activate and  click the button is as below</p>
  <pre><code>Private Declare Auto Function FindWindow Lib &quot;user32&quot; (ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
  Private Declare Auto Function FindWindowEx Lib &quot;user32&quot; (ByVal parentHandle As IntPtr, ByVal childAfter As IntPtr, ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
  Private Declare Auto Function SendMessage Lib &quot;user32.dll&quot; (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
  
  
  Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
      Dim ParentWndHandle As IntPtr
      ParentWndHandle = FindWindow(&quot;#32770&quot;, &quot;View Downloads - Internet Explorer&quot;)
      If ParentWndHandle &lt;&gt; IntPtr.Zero Then
          Dim ChildWndHandle As IntPtr
          ChildWndHandle = FindWindowEx(ParentWndHandle, vbNullString, &quot;DirectUIHWND&quot;, vbNullString)
          Dim btn1 As IntPtr = FindWindowEx(ChildWndHandle, IntPtr.Zero, &quot;Button&quot;, &quot;&amp;Save&quot;)
          SendMessage(ChildWndHandle, WM_ACTIVATE, WA_ACTIVE, 0)
          SendMessage(ChildWndHandle, WM_COMMAND, VK_RETURN, IntPtr.Zero)
      End If
  End Sub
  </code></pre>