Schlingel Posted July 25, 2016 Share Posted July 25, 2016 a questionhow can I prevent multiple start of a UNIGUI EXE ? Thanks Schlingel Link to comment Share on other sites More sharing options...
Harry Rogers Posted July 26, 2016 Share Posted July 26, 2016 Hi Having another app that gets a list of running processes and takes your target exe as a parameter is one easy way to achieve this. The attached code and compiled exe do just that. the useage is 'launcher ExeToAttemptStart ParametersToExe' e.g. launcher c:\myprojects\app1\myapp.exe "some list of parameters that are optional" The included batch file 'runit.bat' tries to start notepad and open abc.txt - it will only open notepad if it's not already running. The app uses shellexecute to start the target and makes no attempt to hide the parent process so there is potential to tidy it up! Running launcher without any parameters simply opens the mainform with the option to view all running processes. You can modify/ extend the function isrunning to include specific users and or paths rather than just the exe name. I found the original code here http://forum.codecall.net/topic/72604-getting-running-processes-list/ some years ago and have used it for a while without issue. May be of some help? Cheers launcher.zip Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted July 26, 2016 Share Posted July 26, 2016 I am using this: procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject); begin CreateMutex(nil, FALSE, 'MyGps'); if GetLastError = ERROR_ALREADY_EXISTS then begin Application.Terminate; end; end; Link to comment Share on other sites More sharing options...
Harry Rogers Posted July 27, 2016 Share Posted July 27, 2016 I think that's just about a perfect answer! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now