如何拦截WebBrowser控件的“选择要上传的文件”窗口打开之前? [英] How to intercept WebBrowser control's "Choose file to Upload" window before it opens?
问题描述
当我invokeMember(click),通常的选择要上传的文件窗体弹出,并在我可能在同一时间使用任何其他应用程序的前面。有没有一种方法来拦截这个窗口,以便我可以在我的表单填充和文件上传在后台? 解决方案
答案是你可能可以,但是这可能是一个荒谬复杂的过程。您可以挂钩到窗口CALLWNDPROCRET通知链,它可以让你得到事件(如对话框创建),然后由浏览器控制器处理。我之前使用过这样的功能,比如压制不受信任的证书的警告对话框,但是我不建议沿着这条路线走下去,除非你完全没有别的选择。
My application has to automate form filling and upload files using a webBrowser control. When I invokeMember("click"), the usual "Choose file to upload" form pops up and comes in front of any other application I may be using at the same time. Is there a way to intercept this window so that I can leep my form filling and file uploading in the background ?
The answer is that you probably can, however it will likely be an absurdly complicated process. You can hook into the windows CALLWNDPROCRET notification chain which can allow you to get to events (like dialog creation) before they are processed by the webbrowser control. I've used this before to do things like suppress the 'untrusted certificate' warning dialog, however I wouldn't recommend going down this route unless you have absolutely no other choice.
这篇关于如何拦截WebBrowser控件的“选择要上传的文件”窗口打开之前?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!