.NET 检查是否有其他应用程序正在运行 [英] .NET Check if another application is running

查看:39
本文介绍了.NET 检查是否有其他应用程序正在运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个为一系列其他应用程序提供核心服务的应用程序.

I have an application that provides core services for a series of other applications.

当另一个应用程序启动时,我想检查服务应用程序是否正在运行,如果没有关闭.

When another of these applications is started, I want to check that the service application is running and if not shutdown.

检查其他应用是否存在的最佳方法是什么?我想我应该在服务应用程序中使用全局互斥锁并检查它在其他应用程序中的存在.这是正确的方法吗?

What is the best method to check for the existence of the other app? I'm thinking that I should be using a global mutex in the services app and checking for it's existence in the other apps. Is this the correct way to proceed?

推荐答案

全局互斥锁方法是一种很好的方法,也是许多应用程序使用的方法.

The global mutex approach is a good one, and one that many apps use.

例如,Windows Media Player 就是这样做的.

For example, Windows Media Player does this.

相关问题:

是使用互斥锁来防止同一程序的多个实例安全运行?

这篇关于.NET 检查是否有其他应用程序正在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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