Strip'em Add-in for Visual Studio 6.0


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

This article was contributed by Itay Szekely - etay@writeme.com.

Environment: Windows NT/9x, Visual C++ 6

This Add-in converts the text format of a file when it is saved in Visual Studio.
This can be very useful when working in a mixed Windows-Unix environment. In Unix, end of lines in text files are identified by line feed characters. In Windows - they are identified by a combination of carriage return and line feed.
This add-in makes sure that files will be saved the way you. want. When invoked, it opens a dialog box in which you can select the text mode you need.

Strip'em Dialog


Copy Stripem.dll to any place you want. A good place would be under the Microsoft Visual Studio folder at Common\MSDev98\AddIns

Open Visual Studio and select: Tools | Customize...

Go to the Add-ins and Macro files tab and click on the Browse button.

Go to the folder to which you copied Stripem.dll and select it. Make sure the Files of type listbox is on Add-ins (.dll).

When closing the dialog, a toolbar will appear with the Strip'em button. Using the customize dialog you can move this button to any other toolbar (if you want to).

Pressing the button will open a dialog box in which you can select the text mode you want to use.

Possible problems

After saving a file, the add-in kicks in and start replacing carriage returns and line feeds. If the file is opened in Visual Studio, it will open a dialog box saying that the file has changed, and will ask if you want to reload it. This is quite annoying so you can set up Visual Studio to automatically reload changed files. To do this, select: Tools | Options | Editor, and check "Automatic reload of externally modified files".
This add-in was built with Visual C++ 6.0 with service pack 3. I haven't tested it with other versions, so you can take your chance. I heard from a friend that it didn't work with DevStudio/Visual C++ 5, so he downloaded the source, compiled it and then it worked.

If the add-in doesn't "remember" its previous settings between Visual Studio sessions, check the registry for the following key:


This is where Visual Studio saves its data and where the add-in creates its sub-keys. If it doesn't exist you may have a Visual Studio setup problems. If the key exists, it should have the following sub-key:


This is where the add-in saves its data. If the key doesn't exist, create it manually and see if it works.

Version History

  • Version 1.01.0

  • Added a new option: save in Windows mode. Until now you could either remove CR characters or do nothing. Now you can convert single LF characters to CR+LF pairs - convert from Unix to Windows format.

  • Version 1.00.2

  • First release outside my small beta tester comunity.


    Download Strip'em Add-in - 18 Kb
    Download source - 21 Kb


    • Clear of undo history

      Posted by Legacy on 09/11/2002 07:00am

      Originally posted by: Adi Goldberg

      Although this code is great and do its job, I have 2 comments regarding:

      1. As mentioned already, it is very slow on big files.
      2. When used it clears the undo history buffer.

      Is there any solution for the 2nd problem ?

      Best Regards,

    • Useful, but very slowly ...

      Posted by Legacy on 07/19/2002 07:00am

      Originally posted by: Yuriy

      This add-in is very useful, but main algorithm is slowly, I rewrote it. (you can check it, please try work with network file with size => 100 kb)

      I can put another approach here and also resolve problem
      with bytes like 0xD 0xD 0xA = 0xA (unix) or
      = 0xD 0xA (windows)

      void crlf_lf(const char* src_path, bool to_unix)
      char* src_buff = 0, *tmp_name = 0;
      long buf_size = 0;
      int src_file = -1;

      // 1. Copy file to buffer.

      // 2. Remove CR from buffer, main algorithm
      long iw = 0;
      for(long ir = 0; ir < buf_size; ++ir)
      if ( src_buff[ir] ^ 0xD ) src_buff[iw++] = src_buff[ir];

      // 3. Open file, deny write access.
      int oflag = _O_TEXT; if ( to_unix ) oflag = _O_BINARY;
      src_file = _sopen(src_path, oflag | _O_WRONLY, _SH_DENYWR );
      if( src_file == -1 ) throw GetLastError();

      // 4. Write buffer to file.
      if ( _write(src_file, src_buff, iw) == -1 ) throw GetLastError();
      else if ( to_unix )
      // 5. Change size of the file.
      if ( _chsize(src_file, iw) == -1 ) throw GetLastError();
      catch( ... )
      _close( src_file ); delete [] src_buff;

      _close( src_file ); delete [] src_buff;

      PS. If to_unix == true file will be saved in Unix format another in Windows.

      Good luck!

    • problems with w2k

      Posted by Legacy on 04/18/2002 07:00am

      Originally posted by: Yann

      I can't have it work as a simple user on w2k
      It works as an administrator, who I am not...

      any hint ?

    • Fix SaveAll

      Posted by Legacy on 02/07/2001 08:00am

      Originally posted by: urcin

      use the Document,Not get_ActiveDocument:
      ((IGenericDocument*) theDocument)->get_FullName(&filenamew);

    • problem with stripem and Save All

      Posted by Legacy on 12/13/2000 08:00am

      Originally posted by: Rob van Berkel

      When I use Save All in VC++ 6.0, stripem doesn't stripe all the files it saves. I must save every file individually. Is there a solution?

    • Fix for DevStudio 5.0

      Posted by Legacy on 02/05/2000 08:00am

      Originally posted by: George

      In the file Commands.cpp replace

      CComBSTR filenamew(MAX_PATH, NULL);

      CComBSTR filenamew(MAX_PATH, (LPCOLESTR)NULL);


      HRESULT CCommands::XApplicationEvents::DocumentSave(IDispatch* theDocument)

      // Save the files (if enabled)
      if (gStripM != SM_NONE)
      IGenericDocument *pDocument;
      m_pCommands->GetApplicationObject()->get_ActiveDocument((IDispatch **)&pDocument);
      if (pDocument)
      // Get the document file name
      #if _MSC_VER >= 1200
      // VS 6.0 or more
      CComBSTR filenamew(MAX_PATH);
      CComBSTR filenamew(MAX_PATH, (LPCOLESTR)NULL);

    • You must have javascript enabled in order to post comments.

    Leave a Comment
    • Your email address will not be published. All fields are required.

    Most Popular Programming Stories

    More for Developers

    RSS Feeds

    Thanks for your registration, follow us on our social networks to keep up-to-date