Real Software Forums

Page 1 of 1

Author:  lenpartico [ Thu Mar 14, 2013 1:23 pm ]
Post subject:  Mutex

I have this code at the very top of the open event of App...

#if TargetWin32 then
'The code looks like this: Class App Inherits Application
'Private Dim mMutex as Mutex 'Make a property in App named mMutex as Mutex and make it Global - not Private
'Sub Open() - In the Open event of App // Create the mutex with your application's name
mMutex = new Mutex( "myApp.exe" )

// Now try to enter the mutex
if not mMutex.TryEnter then

Quit // Since we failed, someone else has a lock on the mutex. - Another instance of myApp.exe is open

end if


and I made a property in App named mMutex as Mutex and I made it Global - not Private

OK, when a second attempt of launching myApp is made the mutex prevents a new window of MyApp from opening as expected, but if I check with Task manager I see that there is another Process of myApp running.

How can I end that other process of myApp programatically?



Author:  MonkeybreadSoftware [ Thu Mar 14, 2013 2:09 pm ]
Post subject:  Re: Mutex

You mean the quit command failed?


Author:  lenpartico [ Thu Mar 14, 2013 4:52 pm ]
Post subject:  Re: Mutex

Hi Christian,

In the example posted it works but in the real app it does not execute the quit command.

It is the same code and it is at the very top of


Author:  lenpartico [ Fri Mar 15, 2013 8:13 am ]
Post subject:  Re: Mutex - Follow-up...


The mutex as it is above works on other apps but not in this particular app.

What could be some of the possible causes?

I put a msgbox immediately below the mutex and is does not display yet the app does not execute the Quit command.



Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group