Solved

How to run at most one instance at a time?

Posted on 1998-09-01
3
231 Views
Last Modified: 2013-11-20
How can i modify the original MDI template so that at most one instance can be run simutaneously?
0
Comment
Question by:p0yang01
3 Comments
 
LVL 2

Accepted Solution

by:
prasanth earned 50 total points
ID: 1321583
In Win32, there are three ways of checking for a previous instance:

· Creating and testing for the existence of a named mutex.
· Creating a unique named pipe
· Calling FindWindow with the window class and name.

Which ever method you choose, it should be done in InitInstance of your application.

The easiest is calling FindWindow in InitInstance and if a window is found, setting focus to it and returning FALSE from InitInstance.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1321584
0
 
LVL 3

Expert Comment

by:danny_pav
ID: 1321585
create a shared segment and that will have data from all instances of the app.  Use InterLockedIncrement/Dec to modify counters in the shared segment
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 37
How to calculate times for developing software? 8 65
pre4 challenge 19 94
wordappend challenge 8 149
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now