并行项目运行时退出项目 [英] Exit the Project when a Parallel Project is running

查看:77
本文介绍了并行项目运行时退出项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有两个exe文件

1. FileProcessingSystem.exe-Vb6.0
2. FileGenerator.exe-控制台应用程序,WCF

我不希望这两个工作并行运行.任何人都可以帮助我做什么/应该使用什么代码,以便如果Exe 1正在运行并且Exe 2启动,我希望Exe 2退出,反之亦然.
在此先感谢

Hi,

I have two exe''s

1. FileProcessingSystem.exe - Vb6.0
2. FileGenerator.exe- Console Application ,WCF

i dont want the two jobs to run parallely. Could anyone please help be what should i do / what code i should use so that if Exe 1 is running and Exe 2 starts i want Exe 2 to exit and vice versa..

Thanks in advance

推荐答案

在启动任何一个程序之前,请检查另一个程序是否已经作为进程运行.如果是这样,请关闭它或执行任何您想采取的措施.

此处的示例代码:如何检查控制台程序当前是否正在运行? [
Before starting anyone of them, check if the other one is already running as a Process. If so, close it or do whatever you want to take action.

Sample code here:How to check a console program currently running or not ?[^]


您可以在两个应用程序中使用已命名的互斥锁(
You can use a named mutex in both apps ([^]). Each app. should check if mutex is taken - if it is then the other app is already running, if not app takes the mutex for itself an continue the work. When the work is done just release the mutex.


这篇关于并行项目运行时退出项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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