C#windows表单与Web浏览器交互 [英] C# windows forms interacting with web browser

查看:125
本文介绍了C#windows表单与Web浏览器交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中开发了一个与电话系统交互的Windows窗体应用程序。



我想在应用程序中添加点击拨号功能。 />


当我点击网络浏览器中的电话号码时,我想将电话号码复制到字符串中并在我的Windows窗体应用程序中执行一些代码。



如有任何帮助,我们将不胜感激。



提前致谢!



我尝试了什么:



我已经研究过使用Selenium但似乎用户必须使用的是Selenium创建的Chrome用于完成上述任务。

I have developed a Windows Form application in C# that interacts with a phone system.

I would like to add click to dial functionality to the application.

When I click on a telephone number in a web browser I would like to copy the telephone number into a string and execute some code in my Windows Form application.

Any help would be appreciated.

Thanks in advance!

What I have tried:

I have looked into using Selenium but it seems that the user must be using an instance of Chrome that Selenium has created to complete the above task.

推荐答案

谷歌为你做了很多答案;



从任何浏览器获取文本(IE,Chr ome,FireFox等) [ ^ ]
Did a Google for you , lots of answers;

get Text from any Browser (IE,Chrome, FireFox, etc)[^]


你可能需要为tel实现自定义协议处理程序。有可能你已经有一个,看看这里的注册表;



HKEY_CLASSES_ROOT \tel



无论如何你需要勾起那个



将应用程序注册到URI方案(Windows) [ ^ ]



这显然要求html对可用手机有效号码



You'll probably need to implement a custom protocol handler for "tel". Chances are you already have one, look at the registry here;

HKEY_CLASSES_ROOT\tel

Regardless you'll need to hook into that

Registering an Application to a URI Scheme (Windows)[^]

This will obviously require the html is valid for a usable phone number

<a href="tel:0123456789">0123456789</a>





要抢占你的下一个问题,允许它在没有正确的html标记的情况下工作是不可能的,因为它会涉及钩入每个浏览器的特定代码,或者为每个浏览器提供一个插件,你无法轻松或可靠地完成这项工作。



To preempt your next question, allowing this to work without the proper html markup isn't going to be possible as it would involve specific code to hook into each and every browser, or to provide a plug-in for every browser and there is no way you'll be able to do that easily or reliably.


这篇关于C#windows表单与Web浏览器交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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