Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Sep 25, 2017 12:05 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Mutex
PostPosted: Thu Mar 14, 2013 1:23 pm 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
Hello,
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

#endif

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?

Thanks.

Lennox


Top
 Profile  
Reply with quote  
 Post subject: Re: Mutex
PostPosted: Thu Mar 14, 2013 2:09 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
You mean the quit command failed?

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Mutex
PostPosted: Thu Mar 14, 2013 4:52 pm 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
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 App.open.

Lennox


Top
 Profile  
Reply with quote  
 Post subject: Re: Mutex - Follow-up...
PostPosted: Fri Mar 15, 2013 8:13 am 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
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.

Thanks.

Lennox


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group