Home » U++ Library support » TopWindow&PopUp, TrayIcon » How to check whether application is running
Re: How to check whether application is running [message #28041 is a reply to message #27925] |
Fri, 13 August 2010 16:21 |
|
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
i used in my app stuff like this:
which is exactely what Mindtraveler described. code snipet like this can be found online in many places..
the name define doesnt really matter, it was only for me. it has to be something unique though, beeing shure noone else will ever use on your system except you.
with SINGLE_APPINSTANCE you can enable or disable this behaviour
//at beginning of your programm#define SEMAPHORE_UNIQUE "Global\\LIPANv2Unique_2FA34E51"
#ifdef SINGLE_APPINSTANCE
#ifdef PLATFORM_WIN32
USemh = OpenSemaphore(STANDARD_RIGHTS_ALL, FALSE, SEMAPHORE_UNIQUE);
if(USemh == NULL)
USemh = CreateSemaphore(NULL, 0, 1, SEMAPHORE_UNIQUE);
else
{
wq & THISBACK1(Closer, "Application already started!!"); //prepare
return;
}
#elif defined(PLATFORM_POSIX)
#endif
#endif
//program runtime....
//at end of your program
#ifdef SINGLE_APPINSTANCE
#ifdef PLATFORM_WIN32
if(USemh != NULL)
CloseHandle(USemh);
USemh = NULL;
#elif defined(PLATFORM_POSIX)
#endif
#endif
[Updated on: Fri, 13 August 2010 16:22] Report message to a moderator
|
|
|
|
|
How to check whether application is running
By: bushman on Mon, 09 August 2010 03:59
|
|
|
Re: How to check whether application is running
By: bushman on Mon, 09 August 2010 04:16
|
|
|
Re: How to check whether application is running
|
|
|
Re: How to check whether application is running
By: bushman on Mon, 09 August 2010 05:18
|
|
|
Re: How to check whether application is running
|
|
|
Re: How to check whether application is running
By: unodgs on Tue, 10 August 2010 22:47
|
|
|
Re: How to check whether application is running
By: kohait00 on Fri, 13 August 2010 16:21
|
|
|
Re: How to check whether application is running
By: Alboni on Wed, 16 January 2013 12:29
|
|
|
Re: How to check whether application is running
By: lectus on Wed, 16 January 2013 14:38
|
|
|
Re: How to check whether application is running
By: Alboni on Wed, 16 January 2013 15:44
|
|
|
Re: How to check whether application is running
|
|
|
Re: How to check whether application is running
By: lectus on Fri, 18 January 2013 01:56
|
|
|
Re: How to check whether application is running
|
|
|
Re: How to check whether application is running
By: Alboni on Wed, 16 January 2013 17:38
|
|
|
Re: How to check whether application is running
By: Alboni on Wed, 16 January 2013 18:01
|
|
|
Re: How to check whether application is running
By: BioBytes on Wed, 16 January 2013 21:32
|
Goto Forum:
Current Time: Thu May 09 03:22:51 CEST 2024
Total time taken to generate the page: 0.02667 seconds
|