Click here to Skip to main content
Click here to Skip to main content

AutoText Add-in for Visual Studio 6.0

, 3 Mar 2001
Rate this:
Please Sign up or sign in to vote.
Adds the auto text feature from MS Word (tm) to the Developer Studio (tm)
<!-- Download Links --> <!-- Article image -->

Sample Image - DeveloperStudioAutoText.gif

<!-- Main HTML starts here -->


I have been using this tool for about a year now for my personal use and it works quite fine. After reading some articles here on CodeProject I felt like I needed to give back something useful to the community. So here it is...

This add-in adds an AutoText feature to Visual Studio similar to the one found in MS Word (tm). It replaces misspellings or can replace abbreviated words while typing with their full text. This can be used to abbreviate hard to type names; for example, UNUSED_ALWAYS (which I abbreviated to ua ). Or to correct common spelling errors; for example, typing TURE and having it replaced with TRUE.

Current version: Version 1,0,0.1 (February 21, 2001)
I'll post updates here when available.


Either download the file and build it for yourself or just download the ready to use build then copy the file DeveloperStudioAutoText.dll to c:\Program Files\microsoft visual studio\common\msdev98\addins or where ever you have installed your copy of visual studio respectively.
  1. Copy DeveloperStudioAutoText.dll to any place you want. A good place would be under the Microsoft Visual Studio folder at Common\MDev98\AddIns.
  2. Open Visual Studio and select: Tools | Customize...
  3. Go to the Add-ins and Macro files tab and click on the Browse button.
  4. Go to the folder to which you copied DeveloperStudioAutoText.dll and select it. Make sure the "files of type" listbox is set to "Add-ins (.dll)".
  5. When closing the dialog, a toolbar will appear with the AutoText-Configuration button (Large 'T' with small "Auto" below it" and a button labeled "H/C+" which toggles between C(++) and the .H-file.
    Like with any other toolbar button you can move this button to any other toolbar.
  6. Press the left button (with the 'T' on it) to setup the AutoText replacement table. Here you can enable/disable the plug-in trough switching on/off the Enable AutoText checkbox.
  7. Type in the Replace edit box the text to be replaced and in the With edit box the text to replace it with. Then press or click on Add New to add it.
  8. With the Delete button you can remove unwanted entries and when the replace text already exists, the Add New button changes to Replace to let you modify existing entries.
  9. When you press the OK button all settings are written to the file %windir%\DSAutoText.CFG which is in fact a standard .INI-file. You may edit it by hand (it's syntax is quite straightforward: In the section [Substitutions] there is a mapping between the original text on the left and the text to replace it with on the right side of the equal sign.
    You should not modify WordListState. This one contains the list view settings (column width and ordering)
  10. While typing the add-in watches for space and opening brackets. When you enter any of these it will search its replacement list and when it finds a suitable one, replaces your typed word with it.
  11. When the replaced text is not what you wanted, just delete it using edit/undo or pressing the backspace key and retype the original text, the next time you enter one of the stopping chars (space or bracket) it will ask if it should replace it and you can cancel replacing by pressing ESC or selecting DON'T REPLACE.
    Replace with question menu

How it works

On loading it tries to identify the main window and the MDIClientArea window (method CDSAddIn::OnConnection). The interesting part follows:
   //First find the main window
   hWnd = ::GetActiveWindow();
   while( hWnd  &&  hWnd != hDesktopWnd )
       m_hDevStudioWnd = hWnd;
       hWnd = ::GetParent(hWnd);

   GetWindowText( m_hDevStudioWnd, szWindowTitle, 512 );
   if( strstr( szWindowTitle, "Microsoft Visual C++" ) )
      m_wndDevStudioMainWindow.SubclassWindow( m_hDevStudioWnd );

      // The MDIArea always has ID 0xe900
      m_hDevStudioMDIArea = GetDlgItem( m_hDevStudioWnd, 0xe900 );

      m_wndMDIAreaManager.SubclassWindow( m_hDevStudioMDIArea );
The line m_wndDevStudioMainWindow.SubclassWindow( m_hDevStudioWnd ); subclasses the DevStudio main window (class C_DevStudioMainWindowFilter. This is necessary because it would otherwise translate some of the cursor movements to WM_COMMAND messages. But as we need the cursor messages we intercept them.

There is another class C_DevStudioMainWindowFilter that is mainly used to easily get the active MDI (a.k.a. text editor) window and to handle the menu and normal keys.

The decision process, if anything needs to be replaced can be found in C_ActiveMDIWindowFilter::OnSpecialKeyPressed(). Of interest, may be the handling of m_bEnableAutoCorrect, which determines if the entered text is automatically replaced or if the user is asked if it should be replaced (after the user pressed delete it will be set to FALSE and back to TRUE when a stop char is pressed).

The actual replacing occurs in CheckAutoText(). If bAutoReplace is TRUE the text will immediately be replaced if possible. Otherwise only the replacement text (if available) will be returned. If there is nothing typed by the user that can be replaced then the return value will be empty and the text will not be changed.

Known Problems

MsDev6 on some systems has a problem to paste text to the editor (Edit/Paste) when copied from the same text window when using macros/add-ins.
As far as I know it's possible to fix this by disabling the new heap manager by adding the following registry key (at least it works on my colleges systems):
Add this key with regedit:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MSDEV.EXE
then add a string value beneath it named DisableHeapLookaside and set it to "1".

This add-in was built with Visual C++ 6.0 with service pack 4. I have tested it also with service pack 3 and it worked fine there too, so I guess it won't make problems with different service packs.

See Q231652 and Q195009 in the knowledge base for more information.

Version History

Version 1,0,0.1
First public release.


The initial idea of subclassing the main window (but not the technique) was also taken from an addin found on code guru. But after over one year I forgot who it was. Sorry about that.

Some of the copyright notices was taken from Yuri Tkachov's enhanced windowlist submission. I hope he does not mind.

Further I have to thank my company (MicroMotion GmbH) for letting me use their equipment (and some time on working hours) to write this addin. (btw. this addin does not fulfill internal coding standards - it's a hobby project)

About Christoph Weber

Christoph Weber is a member of the core development team at MicroMotion GmbH.
He's programming Assembler/C/C++ (and some more) for 18 years now and Visual C++/MFC and ATL for 6 years.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Christoph Weber

Germany Germany
No Biography provided

Comments and Discussions

QuestionWhat about VC5 ? PinmemberVolki28-Jan-02 14:48 
AnswerRe: What about VC5 ? PinmemberChristoph Weber29-Jan-02 11:32 
GeneralRe: What about VC5 ? PinmemberVolkan29-Jan-02 15:04 
Before thanks for your interest to my problem. In fact, when tried to load the dll it gave an error about Header of the IDE but didn't understand why? But then suppose understood that you are looking for VC6 for successfull loading. Then tried to compile it again but compiler gave 37 error and 6 warnings. So latest tried to reverse the dll for error (sorry) and this is OK (only changed the "if(..szWindowTitle,.."Micros.." statement to opposite). And also worked fine but unfortunatly Ide is crashing when quitting. Finally decide to work on code again (I love it!) but not sure to succes this. Because I'm very new on this and errors very much Frown | :( But I will go on if its possible to do this. I must to have this, this project doesn't have a smiler Smile | :) I hope I can.
GeneralCrash... Pinmember| mProject |20-Dec-01 22:51 
GeneralRe: Crash... PinmemberChristoph Weber22-Dec-01 4:31 
GeneralRe: Crash... PinmemberMM5-Feb-02 20:38 
GeneralProblems with paste PinmemberAnonymous6-Mar-01 19:20 
GeneralRe: Problems with paste PinmemberSimon Hughes6-Mar-01 23:58 
GeneralRe: Problems with paste PinmemberChristoph Weber7-Mar-01 2:20 
GeneralRe: Problems with paste PinmemberJoshua Jensen7-Mar-01 10:37 
GeneralRe: Problems with paste PinmemberAnonymous14-Mar-01 13:07 
GeneralFunctioning with other add-ins PinmemberRay Hayes6-Mar-01 1:00 
GeneralRe: Functioning with other add-ins PinmemberSimon Capewell6-Mar-01 4:27 
GeneralRe: Functioning with other add-ins PinmemberChristoph Weber6-Mar-01 11:03 
GeneralRe: Functioning with other add-ins PinmemberSimon Capewell7-Mar-01 0:18 
GeneralRe: Functioning with other add-ins PinmemberChristoph Weber7-Mar-01 4:42 
GeneralRe: Functioning with other add-ins PinmemberJoshua Jensen7-Mar-01 10:40 
GeneralRe: Functioning with other add-ins PinmemberChristoph Weber8-Mar-01 0:40 
GeneralRe: Functioning with other add-ins PinmemberOz Solomonovich8-Mar-01 6:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150327.1 | Last Updated 4 Mar 2001
Article Copyright 2001 by Christoph Weber
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid