Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to run at most one instance at a time?

Posted on 1998-09-01
3
Medium Priority
?
238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
prasanth earned 200 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 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 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