打开浏览器时触发事件 [英] Fire an event when browser is opened

查看:231
本文介绍了打开浏览器时触发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

打开浏览器后,带有一些文本的显示简单消息框如何显示"IE浏览器",c#中是否有任何事件可以在打开浏览器时触发?

打开浏览器后,我的应用程序将继续运行,并显示带有文本的消息框.如何实现此目的.请帮助

Hi All,

How can a display simple message box with some text say "IE Browser" as soon as the browser is opened, is there any event in c# which can be fired when browser is opened.

My application keeps running as soon as i open browser i shld get message box wiht text.How can this be acheieved. Please help

推荐答案

您找不到此类事件,因为…没有诸如打开"之类的概念.

想一想.该应用程序已加载,初始化UI并显示主窗口.您的代码在哪里?然后,该应用程序处理命令行并加载一些资源,或者等待用户在地址行中输入URI.没有什么是开放的".

现在,您应该已经解释了C#的角色和应用程序的类型.可能是ASP.NET应用程序. C#代码全是服务器端的,尽管可以生成一些客户端(JavaScript)代码,但实际上它完全不了解浏览器的概念.服务器端代码无法对它的执行承担任何责任,只有在服务器端运行时完成之后,这种情况才会发生.

让我们尝试一个不同的假设:您的C#应用​​程序是一个UI应用程序,它使用基于IE组件(用于WPF或Forms)的WebBrowser控件之一.这是一个不同的故事,但是在此组件中再也没有打开"事件,因为实际上没有打开任何东西.您的应用程序基本上可以完成与IE相似的操作.在这种情况下,您可以引入自己的事件,例如,在显示主窗体或窗口时触发,但此事件与组件WebBrowser没有任何关系.我认为您真的不需要这样的东西.我也不认为您的应用程序有任何真正的问题.

如果您认为自己有能力并且能够解释您的最终目标,我们很乐意为您提供帮助.

祝你好运,
—SA
You could not find such event because… there is no such concept as "open".

Think about it. The application is loaded, initializes the UI and shows main window. Where is your code here? The application then process command line and load some resources or waits for the user entering URIs in the address line. Nothing is "open", specifically.

Now, you should have explained the role of C# and the type of application. It could be the ASP.NET application. C# code is all server-side, it is actually completely unaware of the concept of browser, even though some client-side (JavaScript) code can be generated. You server-side code cannot get any responsibility of its execution, which happens only after the completion of the server-side runtime.

Let''s try a different assumption: you C# application is a UI application using one of the WebBrowser controls based on IE component (for WPF or Forms). This is a different story, but there is not such thing as the "open" event in this component, again, because nothing is really opened. You application basically does something close to what IE would do. In this case, you can introduce your own events fired, for example, when the main form or windows is shown, but this event has nothing to do with the component WebBrowser. I don''t think you really need something like that. I also don''t think you have any real problem with your application.

If you think you do and are able to explain your ultimate goal, we would gladly help you.

Good luck,
—SA




尝试使用Webbrowser Control导航事件.
如果有人在Windows中打开IE,请检查正在运行的进程,如果进程已启动,则显示您的MessageBox.

问候
Hi,

try Navigating event with Webbrowser Control.
For the case someone opens IE in Windows, check running processes and display your MessageBox if process has been started.

Regards


这篇关于打开浏览器时触发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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