Solved

How to run at most one instance at a time?

Posted on 1998-09-01
3
234 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Folder Comparison 12 54
Whole sheet autoscrub still needed 19 52
sumNumber challenge 16 139
ffmpeg - "rtsp://...... Operation not permitted" 4 86
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 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