且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用C#知道正在运行的进程是桌面应用程序还是商店应用程序或Web应用程序

更新时间:2023-10-10 11:07:22

实际上没有任何方法可以可靠地知道这一点. Web应用程序只是网页的宿主.每个Web应用程序的工作方式都不相同,一个应用程序可以托管任意数量的网页,也可以为每个应用程序创建一个单独的应用程序.建立这种类型的唯一方法 应用程序将查看您关心的每个浏览器并根据其行为构建逻辑.但是,这不会捕获您不支持的浏览器,也不一定能与该浏览器的较新版本一起使用.

There really isn't any way to know this reliably. A web app is simply a host for web pages. Each web app works differently and a single app may be hosting any # of web pages, or it may create a separate app for each one. The only way to build this type of app is to look at each of the browsers you care about and build logic based upon their behavior. However this won't catch browsers you don't support nor will it necessarily work with newer versions of the same browser.

您***的选择是寻找您关心的主要浏览器(IE,Chrome等).如果看到这些进程名称,则说明浏览器正在运行.但是在浏览器中打开标签页需要特定于浏览器的逻辑).这个特殊的问题有 在这些论坛上被问了很多遍,不再重复.您可以通过Google搜索该问题的许多可能解决方案.

Your best bet is to look for the main browsers you care about (IE, chrome, etc). If you see those process names then you know the browser is running. But getting the tabs open in the browser requires browser-specific logic). This particular question has been asked so many times on these forums that it doesn't bear repeating. You can google for the many possible solutions to that problem.

迈克尔·泰勒
http://www.michaeltaylorp3.net

Michael Taylor
http://www.michaeltaylorp3.net