Using VC + + ATL to implement Office COM plug-ins

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.