在c#中更改谷歌浏览器的默认下载 [英] change default download from google chrome in c#

查看:402
本文介绍了在c#中更改谷歌浏览器的默认下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何更改默认下载从谷歌浏览器到我的程序在c#?

例如,如果你点击谷歌浏览器中的链接,它会发送链接到我的程序

我该怎么办?

最好的问候

Hi How can i change default download from google chrome to my program in c#?
for example if you click the links in google chrome, it will send the link to my program
how can i do it?
Best Regards

推荐答案

几年前我购买了Internet Download Manager,随着浏览器的发展/变化,它已被更新很多次。当您设置IDM首选项以将IDM集成到Chrome中时,IDM可以从Chrome中拦截大部分(但不是全部)下载活动。



IDM频繁出现的事实更新只是来处理Chrome集成,以及IDM具有用户选择与七种不同浏览器中的任意/全部浏览器集成的优先级这一事实表明,将Chrome锁定在较低级别可能是一项重大技术如果你能够加入它,可能需要经常更新你的代码。



作为替代方案,如何将浏览器默认下载路径设置为特殊您创建的文件夹,您的应用程序创建了一个要监视的FileSystemWatcher,然后检测下载文件的添加?



例如,请参阅John Simmons关于FileSystemWatcher的两部分CP系列:[ ^ ]。
I purchased Internet Download Manager several years ago, and it has been updated many, many, times as browsers have evolved/changed. IDM is able to intercept most, but not all, download activities from within Chrome when you set the IDM preferences to integrate IDM into Chrome.

The fact that IDM is frequently updated just to deal with Chrome integration, and the fact that IDM has user-preferences for selecting integration with any/all of seven different browsers, suggests that hooking Chrome at a low-level is probably a major technical accomplishment, and may require frequent updates of your code if you are able to hook into it.

As an alternative, how about setting the browser default download path to a special folder you create which your application has created a FileSystemWatcher to monitor, and then detecting the addition of the downloaded file ?

For example, see John Simmons' two-part CP series on FileSystemWatcher: [^].


这是一个错误的想法。您是否要按照应用程序的方式强制执行用户下载的方式?你不应该这样做。用户更好地了解要使用的默认下载程序。如果你能做你想做的事,那就太过于干扰了。



相反,如果你有自己的下载,你不应该攻击默认浏览器,但可以简单地将您自己的下载程序嵌入到您自己的应用程序中,而不是触及任何可用的浏览器。你甚至不能假设用户有Chrome或者甚至不知道那是什么。



如果您想为自己捕获下载,对于您自己的Chrome副本,这不是一个编程问题。



-SA
This is a wrong idea. Are you going to enforce the way the user downloads by your application? You should not do that. The user know better what default downloader to use. If you could do what you want, it would be way too intrusive.

Instead, if you have your own downloaded, you should not "attack" a default browser, but can simply embed your own downloader in your own application, not touching any available browsers at all. You cannot even assume that the user has Chrome or even knows what is that.

And if you wanted to capture downloading just for yourself, for your own copy of Chrome, it would not be a programming question.

—SA


这篇关于在c#中更改谷歌浏览器的默认下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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