At program startup, I want to check for other instances. If instance found from the current directory, exit. If instance found from another directory, continue. I found some codes here in this forum but I am having hard tome to make it work as I want to.
The code is:
Code: Select all
Global ProductID$ = GetCurrentDirectory() + "MyApp"
Global Mutex = CreateMutex_(0,1,@ProductID$)
If Mutex = 0 Or GetLastError_() = 183;ERROR_ALREADY_EXISTS
MessageRequester("","Program already running!",#MB_ICONERROR)
Else
MessageRequester("","No other instances.",#MB_ICONINFORMATION)
EndIf