Code Template add-in for Visual C++ 5.0
Install
Build the CodeTmpl project using the Win32 MinDependency build configuration, and copy the CodeTmpl.txt file into your DevStudio\SharedIDE directory. Install the CodeTmpl add-in by selecting Customize from the Tools Menu and browsing for the DLL on the 'Add-ins and Macro files' tab. The add-in should appear as 'CTAddIn Class' in the list of active add-ins. Once installed a new toolbar with a single button should appear for the CodeTmpl add-in.
Overview
So what does this thing do for me you're wondering. Well the CodeTmpl.txt that you copied into your SharedIDE directory contains chunks of source code delimited into named blocks. When you click on the CodeTmpl toolbar button you'll see those same names appear on a popup menu, and should you select one, then the appropriate chunk of source code will be glued into your current source code document at the insertion point.
Configuration
Clearly my idea of useful bits of code is probably not yours, so the CodeTmpl add-in is completely configurable, by simply editting the CodeTmpl.txt file.
The format of the CodeTmpl.txt file is extremely simple. Basically you paste your favourite blocks of source code into the file and put a pair of 'tags' at the beginning and end of each block. The tag '#{' goes at the beginning of the block and the tag '#}' goes at the end. The '#{' tag should be followed by a name for that block that will appear on the popup menu. The tags must appear at the beginning of a new line. Any text outside of the tags is ignored, with the exception of a string of 2 or more hashes which cause a separator to appear on the pop up menu.
For example :
#{Hello World - Console
#include
int main()
{
puts("Hello, World");
}
#}
##########################
#{Hello World - GUI
#include
int PASCAL WinMain(HANDLE hInstance,
HANDLE hPrevInstance,
LPSTR lpszCommandLine,
int cmdShow)
{
MessageBox(NULL, "Hello, World", "Example", MB_OK);
}
#}
If your CodeTmpl.txt contained the above text then clicking the CodeTmpl toolbar button would display a popup menu containing the options 'Hello World - Console' and 'Hello World - GUI', with a separator between them. Selecting 'Hello World - Console' would paste the text shown between the '#{' and '#}' tags into your source.
Tips
If you click the CodeTmpl toolbar button with the 'Control' key down, then the CodeTmpl.txt is re-read by the add-in before the popup menu is displayed. This is to allow for on the fly configuration changes.
When editting the CodeTmpl.txt file in DevStudio, right hand mouse click the window in which it is open, select Properties from the context menu and set Language to C/C++ from the property dialog. This will give you color coding and make the tab key do what is ought to.

Comments
Help Cannot compile CodeTemplate - causes Computer restart.
Posted by Legacy on 02/11/2003 12:00amOriginally posted by: Gargoyle
ReplyHas anyone got this add-in work in VC 6?
Posted by Legacy on 07/21/2002 12:00amOriginally posted by: vcHelpBoy
Hi, I just started to learn programming a couple of weeks ago. I tried many times to apply this add-in WITHOUT success. Could anybody tell me how to get it work?
Here are my steps for doing this (please correct me if I am doing wrong):
1) Build under mode "Win32 Release MinDependency";
2) Move the "CodeTmpl.dll" and "CodeTmpl.txt" to the folder
"C:\Program Files\Microsoft Visual Studio\Common\MSDev98\AddIns";
3) Install the add-in: Tools -> Customize -> Addins and Macro Files (Tab) -> CTAddIn Class;
4) Then it puts a Toolbar in the editor.
However,
when I opened a .cpp file and Ctrl + click the toolbar, nothing happened.
Please help me if you have a couple of minutes.
Thanks!
vcHelpBoy
ReplyHas anyone ported this to VS.NET yet, as the V5/6 version doesn't seem to work on VS.NET
Posted by Legacy on 05/09/2002 12:00amOriginally posted by: Richard Blundell
The dll addin won't load in VS.NET
Reply
It doesn't work, when both VC5 & VC6 installed
Posted by Legacy on 01/31/2001 12:00amOriginally posted by: Loki
%subj% because MSDevDir in that case looks like this:
MSDevDir=C:\Program Files\Microsoft Visual Studio\Common\MSDev98;C:\Program Files\DevStudio\SharedIDE
I think, it very easy to fix =)
Reply
very good
Posted by Legacy on 11/08/2000 12:00amOriginally posted by: eom, hee jung
Thanks^^
ReplyMerge all, please...
Posted by Legacy on 08/22/1999 12:00amOriginally posted by: Paul Selormey
Hello Darren Richards,
It is rather unfortunate for the good people who extended this addin to submit them separately. But please can you take the pains to merge most of these new features for us?
Best regards,
ReplyPaul.
A change which allows the configuration file to be in the same dir as the DLL (version 6.0)
Posted by Legacy on 06/29/1999 12:00amOriginally posted by: Mark Johnston
ReplyGreat work!
Posted by Legacy on 04/01/1999 12:00amOriginally posted by: Tom
A great way to standardize development. Thanks!
ReplyA good to for Autoduck
Posted by Legacy on 11/11/1998 12:00amOriginally posted by: Rosa Bernardez
Reply