使用C#应用程序关闭浏览器 [英] close a browser using c# application

查看:159
本文介绍了使用C#应用程序关闭浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在开发一个使用Twitterizer的WPF应用程序.我的应用程序如下所示.
1.用户单击WPF应用程序中的登录按钮
2. twitter网站在默认浏览器中打开
3.从twitter生成一个图钉
4.用户手动输入该引脚到WPF表格
5.现在,我想通过c#代码关闭该浏览器选项卡

有什么办法可以关闭IE,firefox或chrome的单个标签吗?
如果不可能,请描述一种方式,以便打开新的浏览器进程,然后可以通过c#代码关闭.

Hello, I''m developing a WPF application which uses twitterizer. My app works as following.
1. User clicks login button from WPF application
2. twitter website opens in default browser
3. a pin is generated from twitter
4. user manually enters that pin to WPF form
5. Now, i want to close that browser tab via c# code

Is there any way to close a single tab of IE, firefox or chrome?
If its not possible, then please describe the way so that a new browser process opens and then can be closed via c# code.

推荐答案

也许执行外部进程不是原则上是个好主意.您可以做到,但这是有问题的,并且缺乏可靠性.除非它们使用一些用于协作的技术IPC进行设计,否则流程是完全隔离的.考虑使用嵌入在您的应用程序中的Web浏览器:
http://msdn.microsoft.com/en-us/library/system. windows.controls.webbrowser.aspx [ ^ ].

—SA
Maybe executing external process is not a good idea in principle. You can do it, but this is problematic and lacks reliability. Processes are well isolated, unless they designed with the use of some technology for collaboration, IPC. Consider using Web browser embedded in your application:
http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx[^].

—SA


同意SA.

为此,您可以在WPF应用程序中使用Web浏览器控件.

http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/web -browser-control-in-wpf/ [
Agreed with SA.

you can use web browser control in your WPF application for this purpose.

http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/web-browser-control-in-wpf/[^]


这篇关于使用C#应用程序关闭浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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