Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3791

Mutex under Windows re-launches

$
0
0

To prevent my app under Window to launch twice, I stumbled upon this Mutex function.
In the App.Open method I did this among other things:

’ Windows: Mutually exclusive flag
#if TargetWindows then
mutex = new NamedMutexMBS(“my app”)
if mutex.Locked then
Quit ’ already running
else
mutex.Lock
fMutex = true
end
#endif

In the App.Close method I do this among other things:

#if TargetWindows then
if fMutex = true then
fMutex = false
mutex.Unlock ’ app done
else
return
end
#endif

What happens ist the following:
Indeed, the second version of the app does not launch.
But when the first one is done, the second launches as if it had waited in a queue.
What’s wrong here?

5 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 3791

Trending Articles