Summary
This article describes the use of VC + + ATL (Active Template Library), using the IDTExtensibility2 interface to add a simple COM plug-in (addin) to Microsoft Word, Adding visual parts, such as toolbar buttons and menus, and adding a way to respond to events, and at the end of the paper, provides a simple way to implement a hybrid programming with Office macros.
When it comes to office-related programming, it's possible that VBA (Visual Basic for application) is the first thought, and ATL is a good tool in fact. This is an ATL based office programming approach that is simple to implement and is just an example of the following steps:
1. In Visual C + + programming environment, use the wizard to generate an ATL COM AppWizard project named Wordaddin:
In the first dialog box of the wizard, select the default server type dynamic Link Library (DLL) and select the Allow merging of proxy-stub code option in the three check boxes below. Then click Finish so that an empty ATL project is created (figure I).
Figure I
2. Insert our ATL object:
Select Menu Insert->insert New ATL Object, appear in the New ATL Object Wizard dialog box, select Object in the Category list on the left, and select the corresponding simple object on the right, Click Next (Figure II):
Figure II