Chapter 7: Office COM Add-Ins


Overview

When you develop Microsoft Office solutions, you probably want to extend existing Office applications by adding new functionality. In Microsoft Outlook 98, you can add new forms to your application's Outlook environment, but you cannot easily add new toolbars or program your application to respond to events other than form events such as Item_Open or Item_Read . To provide functionality beyond that of forms, you have to write an Exchange Client Extension, which involves strict requirements and coding practices, and any extensions have to be written in C/C++. With Outlook 98, a Microsoft Visual Basic or VBA developer is stuck either hacking a solution together or not enhancing the functionality at all.

Office 2000 and later includes support for COM add-ins. A COM add-in is a dynamic-link library (DLL) that can be used to add functionality to an Office application, and, as you can guess by the name , a COM add-in can be built using any COM or Microsoft .NET development tool, including Visual Basic, Visual C#, and Visual C++. Because COM add-ins are compatible with all Office products, you can design an add-in once and use it in several applications. For example, you can write a COM add-in that uses the CommandBar object model, which is shared across all the Office products, to customize the toolbars in your applications.

Note  

The COM add-in I describe in this chapter can't be used across all the Office applications because it calls functionality that's specific to Outlook. However, the concepts behind building this COM add-in can be applied to any add-in designed for other Office applications.

COM add-ins are registered to be loaded by Office 2000 and later applications. Because COM add-ins are designed as in-process DLLs, they run in the same address space as the host application. One benefit of an in-process add-in is that it has efficient access to the object model of the host application, allowing the add-in to call methods and properties quickly or to receive events from the host application. One caution about running an add-in in-process is the danger of slowing down or even crashing the host application. Keep this in mind during development.

Note  

This chapter shows how to build COM add-ins using Visual Basic and C#. The sample code includes a COM add-in built with Visual C++ for your reference.




Programming Microsoft Outlook and Microsoft Exchange 2003
Programming MicrosoftВ® OutlookВ® and Microsoft Exchange 2003, Third Edition (Pro-Developer)
ISBN: 0735614644
EAN: 2147483647
Year: 2003
Pages: 227
Authors: Thomas Rizzo

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net