Web浏览器->文件下载->永远不会出现另存为对话框 [英] WebBrowser --> File Download --> Save As Dialog Never Appears

查看:108
本文介绍了Web浏览器->文件下载->永远不会出现另存为对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Basic .NET 2010

Visual Basic .NET 2010

.NET Framwework 4

.NET Framwework 4

使用Windows API函数:

Using Windows API Functions:

GetForegroundWindow()

SendMessage()

当出现文件下载"对话框时,我成功发送了button.click事件以保存按钮.

SendMessage(WindowHandle,BM_CLICK,0,

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

问题在于第二个对话框(另存为)永远不会出现!

我停留在发出Thread.Sleep(200)和Application.DoEvents()的循环中,等待出现另存为"对话框.

我想念什么吗?

推荐答案

覆盖下载对话框的受支持方法是

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. 

我不确定您使用的是哪个类库(CLR只是一个运行时),因此我无法建议如何扩展该类库使用的ActiveX容器.对于Windows窗体,您可以找到一个示例 这里.您可能想在类库论坛中询问如何扩展该类库中的ActiveX容器.在IE扩展开发论坛中有一些有关如何添加IDownloadManager的讨论.

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.


这篇关于Web浏览器->文件下载->永远不会出现另存为对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆