MontgomeryBurns
July 7th, 2004, 02:37 AM
How can I prevent from opening more than one instance of my application? e.g. I want that when the user clicks on the exe file for the 2nd time then the program quits immediately.
|
Click to See Complete Forum and Search --> : I want one application instance only MontgomeryBurns July 7th, 2004, 02:37 AM How can I prevent from opening more than one instance of my application? e.g. I want that when the user clicks on the exe file for the 2nd time then the program quits immediately. BinaryAnge July 7th, 2004, 07:48 AM in the main(), do a wrap on the Application.Run(new yourapp); Process[] p = Process.GetProcessByName("youApp"); if (p.Length == 1) Application.Run(new yourapp); MontgomeryBurns July 7th, 2004, 08:35 AM Thank you very much! I could replace that Homer Simpson with you in my factory! But mind the spelling: Process[] p = Process.GetProcessesByName("youApp"); if (p.Length == 1) Application.Run(new yourapp); codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |