Solved

Visual C++ Single Instance

Posted on 1997-09-15
2
349 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

747 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

9 Experts available now in Live!

Get 1:1 Help Now