none
WebBrowser --> File Download --> Save As Dialog Never Appears RRS feed

  • Question

  • Visual Basic .NET 2010

    .NET Framwework 4

    Using Windows API Functions:

    GetForegroundWindow()

    SendMessage()

    When the File Download Dialog appears I was successful in sending the button.click event for the SAVE button.

    SendMessage(WindowHandle, BM_CLICK, 0,IntPtr.Zero)

    The problem is that the 2nd dialog (Save As) never appears!

    I stay in a loop issuing Thread.Sleep(200) and Application.DoEvents() waiting for Save As Dialog to appear.

    Am I missing something?

    Monday, November 12, 2012 7:25 PM

All replies

  • The supported way to override the download dialog is to implement your own download manager in your ActiveX container. Basically you need to add an IServiceProvider implementation to the container (or change an existing one, if your ActiveX container already implements that interface), then the WebBrowser control would call the container's IServiceProvider::QueryService implementation to retrieve an IDownloadManager interface pointer, and call your IDownloadManager implementation instead of IE's download manager. 

    I am not sure which class library you are using (CLR is just a runtime), so I am unable to advise how to extend the ActiveX container used by that class library. For Windows Forms, you can find an example here. You probably want to ask in a class library forum for how to extend the ActiveX container in that class library. There are some discussions about how to inplement IDownloadManager in the IE extension development forum.



    Visual C++ MVP

    Monday, November 12, 2012 9:51 PM
  • Thank you for the suggestion but my problem is a bit more complicated.

    The program is attempting to automate the users task of:

    1. Logging in to a secure third-party website

    2. Entering search criteria

    3. Downloading a file

    The problem is with item 3. The IE pop-up (File Save Dialog) has modal control and my program waits for a response.

    I was able to get around the wait state by enabling a timer that issues SendMessage() & SendKeys() that handles the pop-up Dialog.

    However, when a second pop-up occurs ('Save As' Dialog) it stops my program.

    I was able to get around the wait state by enabling a second timer that issues SendMessage() & SendKeys()

    There must be a better way.

    Can you please help?

    Thank you


    • Edited by JoeGuzman10 Wednesday, November 14, 2012 1:57 PM
    Wednesday, November 14, 2012 1:56 PM
  • Thank you for your quick response!

    I am developing the application using 2010 VB.net , Windows 8, and IE10

    I looked at the Webbrowser wrapper control example you provided below:

    http://www.codeproject.com/Articles/18935/The-most-complete-C-Webbrowser-wrapper-control

    This code was written in 2007 and does not provided any support.

    Thank you again.

    Friday, November 23, 2012 2:07 PM