Programming implementation of internal COM plug-ins under Office 2000

Source: Internet
Author: User

Brief introduction

You may have seen some new custom toolbar buttons or menu bars added by other software in the Word2000, Access2000, Excel2000, PowerPoint2000, and other software toolbars or menu bars under Office2000, and when clicked, There will be different responses to occur. Below, let's also implement these features, and it's important to note that here we do not need to vb/vba to implement it, but rather to develop Office2000 internal COM plug-ins with this effect with the ATL (Active Template Library) in VC6. In Office2000, both Word2000, Access2000, Excel120000, PowerPoint2000, and Outlook2000, their COM plug-ins have very similar programming methods and procedures ( Except for the key values in the registry and the import of the corresponding type libraries.

Basic knowledge

An Office2000 internal COM plugin must implement a _idtextensibility2 distribution interface, _idtextensibility2 distribution interface is defined in the Msaddin Designer type library (msaddndr.dll/ MSADDNDR.TLB), usually located under the < >/program Files/common Files/designer. The following five interface functions must be implemented in the _idtextensibility2 interface (generally you only need to write the code in OnConnection and OnDisconnection), respectively, as follows:

1. OnConnection: Handling when loading plug-ins into memory (automated loading of plug-ins can be done automatically when the program starts).

2. OnDisconnection: Handling when unloading the plug-in from memory.

3. onaddinsupdate:com plug-in changes when processing.

4. OnStartupComplete: When the application starts, the plug-in is processed when it is just loaded.

5. OnBeginShutdown: When the application shuts down, the plug-in is processed when the unloading is complete.

Registering Plug-ins

It can be loaded by its application only if the internal COM plug-in for the appropriate application is properly registered. The following key values need to be created in the registry:

Hkey_current_user\software\microsoft\office\<theofficeapp>\addins\<progid>

Where Theofficeapp represents the appropriate program name, such as Word, Outlook, and so on, ProgID represents a string representation of the unique identifier of an internal COM plug-in, such as Outlook2000addin.addin.

ProgID key values create the following four key values:

1. FriendlyName: String type, the name of the plug-in, will be seen in the corresponding program's COM load dialog box.

2. Description: String type, plug-in description information.

3. Loadbehavior:dword type, determine what form the plug-in will be loaded. When the value is 0x03, it is automatically loaded for application loading (typically using this value), and when its value is 0x08, the activation mount is controlled for the user.

4. Commandlinesafe:dword type, command-line mode, can be set to 0x01 (true) or 0x00 (false).

A complete description of the other key values is available in the latest MSDN.

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.