One of the many aggravations of Visual Studio is the inflexibility in changing the
source code control (SCC) provider. After researching the problem, I found that all
SCC provider information is stored in the registry under
If you open up the registry and go to this key location, you will, more or less, find
the keys self-explanatory. My first attempt to work with this was to create a batch
file to change the registry key for me. I then decided to learn how to create add-ins
and this is my first add-in project. Since I'm including the source code in this article,
I decided against showing code snippets because it wasn't very necessary. This really
is a very simple add-in that shouldn't be all that difficult to follow. Hope it meets
Creating an Add-in
To begin, open Visual C++ and create a new Workspace using the DevStudio Add-in Wizard.
Other articles might say that using a wizard is bad, which I tend to agree with, but for a
first-time user, that's all one usually has or knows. Give your project a name and click OK.
Fill in the add-in name and add a description. This should create various files in your
project, among which is Commands.cpp
Open up Commands.cpp and go to
This is where your code gets called. Next, I proceeded to create a dialog that accessed
the registry, and called it using
dlg.DoModal() from the previous
function. Once you're done setting it up, building it should create an add-in DLL that
Visual Studio can use.
To use the DLL from within Visual Studio, go to Tools | Customize, or right-click on
the menu area and select Customize. Click on the "Add-ins and Macro Files" tab and select
browse to search for your add-in. Remember to change the file type at the bottom of the
browse dialog from "Macro Files" to "Add-ins", otherwise you won't see it. Once selected,
click Open then Close to see a new toolbar appear.
The source code to complete your add-in can be found in the downloadable
Fixes to common problems found:
After selecting your add-in, the name should appear in the "Add-ins and Macro files" tab
in the Customize dialog. If you highlight your add-in, the description that you added in the
wizard appears on the right hand side. This can be changed in the String Table in the
resources window. To change the add-in string that appears in the left hand side, search
DECLARE_REGISTRY in DSAddin.h and change the second argument to fix it.
To change the toolbar icon, modify
Limitations in this add-in:
For the life of me, I can't seem to figure out how to change the toolbar name programmatically.
Visual Studio tends to name all new toolbars as Toolbar#. This seemed to be the most difficult
thing to change. To change it on startup, open up the Customize dialog and click on the "Toolbars"
tab. Change the name of the toolbar to whatever you want and click OK.
Recompiling the project without unselecting the add-in and closing Visual Studio. Will have to
look into this one some more.
Changing the SCC Provider without having to close Visual Studio.
Once I find more documentation on what the registry values under the Options key are, I
will replace them with something more readable.
Building my project under DEBUG mode will probably fail. The problem is due to a
class that I'm using in my About dialog.
All questions, comments, or feedback are always appreciated.
30 May 2002 - updated source.