Solved

Visual C++ Single Instance

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

726 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