Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
kohait00 is currently offline  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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: TopWindow minimum size
Next Topic: Timeout on PromptYesNo?
Goto Forum:
  


Current Time: Thu May 09 03:22:51 CEST 2024

Total time taken to generate the page: 0.02667 seconds