Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to ensure only one instance of the application 1

Status
Not open for further replies.

scottmanjoe

Technical User
Mar 28, 2003
15
IN
Hello,
How to ensure that there is only one instance of the application that is running.
Thanks,
Scott
 
//declaring section as read/write/shared
#pragma comment(linker, "/section:SomeSectionName,rws")

#pragma data_seg("SomeSectionName")//begin of section
//the section there will be shared
//between different instances of programs

static bool isRunningAlready = false;

#pragma data_seg() //end iof section

int main()
{
if(isRunningAlready)return 0;
isRunningAlready = true;
......
return 0;
}

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top