Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Dec 07, 2019 1:54 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to compile a Windows app to run as single instance only
PostPosted: Fri Jul 13, 2012 3:37 pm 
Offline

Joined: Sat Nov 26, 2005 4:51 am
Posts: 346
Is there any quick way to force a Windows app to run as single instance only, i.e. if user double-clicks on icon when the app is alredy running it won't open a second main window instance, like on Mac?

Regards,
- Oskar


Top
 Profile  
Reply with quote  
 Post subject: Re: How to compile a Windows app to run as single instance o
PostPosted: Fri Jul 13, 2012 3:43 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Please check mutex class in docs.

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: How to compile a Windows app to run as single instance o
PostPosted: Fri Jul 13, 2012 5:48 pm 
Offline

Joined: Sat Nov 26, 2005 4:51 am
Posts: 346
Thanks a lot, Christian.

Regards,
- Oskar


Top
 Profile  
Reply with quote  
 Post subject: Re: How to compile a Windows app to run as single instance o
PostPosted: Tue Jul 24, 2012 3:30 am 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
Hi,
this is what I use:

Hope it helps.

pMutex = New Mutex("myBrilliantApp")
If not pMutex.TryEnter Then
MsgBox("myBrilliantApp is already running !")
Quit()
End If

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: How to compile a Windows app to run as single instance o
PostPosted: Tue Jul 24, 2012 1:37 pm 
Offline

Joined: Sat Nov 26, 2005 4:51 am
Posts: 346
Thanks, I sorted it with the same trick.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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