如何确保有一个应用程序实例正在运行 [英] How to make sure that there is one instance of the application is running

查看:249
本文介绍了如何确保有一个应用程序实例正在运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查用户何时双击应用程序图标,确认该应用程序的其他实例尚未在运行.

I want to check when the user double click on applictaion icon that no another instance of this application is already running.

我了解了My.Application,但我仍然不知道该怎么办.

I read about My.Application but i still don't know what to do.

推荐答案

最常见的模式是使用Singleton模式.由于您还没有表示语言,所以我假设您在这里指的是C#-如果不是,则大多数OO语言的原理仍然相同.

The most common pattern for doing this is to use the Singleton pattern. As you haven't indicated a language, I'm going to assume that you are referring to C# here - if not, the principles are still the same in most OO languages.

这篇文章应为您提供一些帮助.

This article should give you some help.

这篇关于如何确保有一个应用程序实例正在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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