ReplAll: Uses Automation to Implement Replace Across Open Text Files
ReplAll resembles the Find and Replace dialog box but will find and replace text in all open text files.
To build the sample
Click the link at the beginning of this topic to download the sample files.
In Visual C++, open the project file ReplAll.dsp.
Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).
Click Rebuild All from the Build menu.
To run the add-in
From the Tools menu, click Customize.
Click the Add-ins and Macro Files tab.
Select the ReplAll.dll file or browse for it. See Tips for Using Add-ins.
Visual C++ will load the add-in. When you close the Customize dialog box, ReplAll’s toolbar will appear.
Run the ReplAll add-in by clicking the toolbar button. Clicking this button opens a dialog box that resembles the Find and Replace dialog box in Visual C++:
It has check boxes for Match whole word only, Match case, and Regular Expression as well as buttons for Replace All and Cancel.
It has two edit boxes: Find what and Replace with.
ReplAll deals with the various emulation modes, such as the Brief and Epsilon editors.
This sample demonstrates the following keywords:
IApplication, CComPtr, CComQIPtr; CComBSTR; CComVariant; IDocuments::get__NewEnum; IEnumVARIANT::Next; CComVariant; IDocuments::get_Count; Item; ITextDocument::ReplaceText; ITextEditor::get_Emulation ; IApplication::get_ActiveDocument ; addin; customize; ItextDocument; ITextSelection