查找应用程序先前实例的最简单方法 [英] Easiest way to find previous instance of an application

查看:141
本文介绍了查找应用程序先前实例的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用Delphi重写了VB6应用程序.它应该只运行一个实例.如何用最少的代码做到这一点?

I have rewritten a VB6 application in Delphi. It should have only one instance running. How can I do this with minimum of code?

在VB6中,我们只需要使用一行代码 >

In VB6 we just have to use one single line of code >

如果App.PrevInstance然后 '采取一些行动 如果结束

If App.PrevInstance Then 'Take some action End If

在进行泳镜检查时,我确实找到了解决方案,但是它的长度非常长,我们必须弄乱.drp文件.

On goggling I did find a solution but it is very length and we have to mess with .drp file.

我不想那样做.

我想要更简单的东西.

推荐答案

请注意,在许多情况下,用户期望启动第二个实例会导致第一个实例被还原并带到前台.不要指望用户理解还原最小化/隐藏的应用程序与从快捷方式或开始菜单启动之间的区别.

Note that in many cases, the user's expecation will be that launching the second instance results in the first instance being restored and brought to the foreground. Don't expect users to understand the difference between restoring a minimized/hidden app and launching from a shortcut or start menu.

这篇关于查找应用程序先前实例的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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