restrict open multiple times on same application
-
Hi, I have created a windows application using VB.NET its working fine there is no issue on that applicaiton. My problem is i want to restrict multiple times of running the same application. for example if i click and run the exe file it will open the application again click on the same exe file it will open the same application second time. I want to restrict that if u click on the exe n time it should open one not many. is it possible if so can u plz guide me how to do that.
Thanks Warm Regards Prakash-B
-
Hi, I have created a windows application using VB.NET its working fine there is no issue on that applicaiton. My problem is i want to restrict multiple times of running the same application. for example if i click and run the exe file it will open the application again click on the same exe file it will open the same application second time. I want to restrict that if u click on the exe n time it should open one not many. is it possible if so can u plz guide me how to do that.
Thanks Warm Regards Prakash-B
Hi You can iterate though the processes running on the machine to see if one is running with the same name as the current application. Code would look like Dim currentProcess as Process = Process.GetCurrentProcess Dim allProcesses as process() = process.getprocessesbyname(currentProcess.ProcessName) For each process as Process in allProcesses If process.Id = current.Id then continue for If [Assembly].GetExecutingAssembly().Location.Replace("/", "\") = currentProcess.MainModule.FileName Then 'There is another version running Throw new exception("Application already open") end if next Thats just entered but should give you a good idae of how to code this...
-
Hi, I have created a windows application using VB.NET its working fine there is no issue on that applicaiton. My problem is i want to restrict multiple times of running the same application. for example if i click and run the exe file it will open the application again click on the same exe file it will open the same application second time. I want to restrict that if u click on the exe n time it should open one not many. is it possible if so can u plz guide me how to do that.
Thanks Warm Regards Prakash-B
-
Hi, I have created a windows application using VB.NET its working fine there is no issue on that applicaiton. My problem is i want to restrict multiple times of running the same application. for example if i click and run the exe file it will open the application again click on the same exe file it will open the same application second time. I want to restrict that if u click on the exe n time it should open one not many. is it possible if so can u plz guide me how to do that.
Thanks Warm Regards Prakash-B
hi, go to Properties of Project & click on application tab now click on checkBox related to "Make single instance application" hope this helps
Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)
-
hi, go to Properties of Project & click on application tab now click on checkBox related to "Make single instance application" hope this helps
Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)
Thanks for your flying reply its working for me
Thanks Warm Regards Prakash-B
-
run this on Form1_Load
If (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0) = True Then End End If
Thanks for your flying reply its working for me
Thanks Warm Regards Prakash-B