Solved

Visual C++ Single Instance

Posted on 1997-09-15
2
350 Views
Last Modified: 2012-06-21
I am currently using Visual C++ 4.1 under NT 3.51. I am also using a configuration management package called MKS Source Integrity which utilises file manager's associations to view files, i.e. if I associate .c, .cpp, .h, .rc etc files with VC++ under file manager then all these types of files will be viewed from within VC++. This is all pretty straightforward, however when I try to open a file from MKS or file manager when VC++ is already open, i.e. there ia already an instance of the application running, then another instance of VC++ is created. How can I setup VC++ to limit itself to only one application?
0
Comment
Question by:aj2
2 Comments
 
LVL 7

Accepted Solution

by:
faster earned 10 total points
ID: 1169776
There is no such way.  When you open a file in explorer, the system will check the registry to see which application is registered with the file association.  Normally it is invoked by creating another instance of the application.  Some applications can avoid this by using DDE, for example, if you look at the registry for the shell association of .html, you will see that it has not only the command line info but also the DDE info, so when you open an html file, the system will not invoke a new instance.  For VC, it does not provide such an interface (which you can verify from the registry) and therefore what you want is impossible.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1169777
NO - vc DOES provide such an interface (ie DDE).

In the explorer go to View|Options|File Type

Lookup the file type for, say, .c (which might be called "C Source File")

Highlight it and Click on the "Edit" button (or double click on the file type in the list)

Higlight the "Open" command in the "Actions" list and click on the "Edit" button (or double click on the open acton)

You should see your command line will be the path to your vc ide program with "%1" at the end.

Click on the Use DDE checkbox

The DDE MEssage should be: Open("%1")
The Application should be your ide app name (no path, no extension), for VC5 is it 'msdev', not sure for vc 4 - look at the top edit box for the name
DDE application not running - leave blank
Topic should be: system

Please reject previous reply and let me answer this one if you find it helpful.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

862 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

22 Experts available now in Live!

Get 1:1 Help Now