COM Add-in for Microsoft Visio


A COM add-in is a COM object that implements the IDTExtensibility2 interface. You can use any Microsoft programming environment, such as Visual Studio .NET 2003, to create the COM add-in. COM add-in enables Visio to interact with the .NET host applications. For example, a Web service created in .NET retrieves certain images from a database, which you can use in any application. You can access this Web service from Visio and insert the retrieved images in a Visio document using a COM add-in. The COM add-in retrieves the images from the Web service and interacts with the Visio document to provide images.

Features of COM Add-in

The features that enable a COM add-in created in .NET to interact with Visio are:

  • The COM add-in for Visio is loaded into the memory along with Visio. As a result, the COM add-in supports in-process execution.

  • A COM add-in as a Dynamic Link Library (DLL) provides better performance than as an EXEcutable (EXE) because DLLs run in the same process as the host application.

Behavior of COM Add-in

After a COM add-in loads with Visio, Visio does not call the COM add-in directly. As a result, Visio cannot run a COM add-in in response to any end user action in the host application. However, you can program your COM add-in to monitor certain events such as visEvdCodeDocCreate() and respond when Visio raises these events. For example, you can write code for the visEvdCodeDocCreate() event to display a welcome message when the end user creates a new Visio document.

Note  

The information about the name , location, and load behavior of a COM add-in is stored in the system registry.

Creating Com Add-in in .Net

You can create a Visio COM add-in in .NET. The .NET code is a managed code, while the Visio implementation is an unmanaged one. As a result, Visio needs a mechanism to communicate with the .NET code.

Note  

The code the Common Language Runtime (CLR) executes is called managed code.

COM Interop allows unmanaged code to call managed code. The COM add-in calls a Visio Primary Interop Assembly (PIA), which is a .NET assembly. The Visio PIA allows integration of the managed .NET code and the unmanaged Visio code.

There are three PIAs for Visio 2003:

  • Visio 2003 type library PIA: Facilitates interaction of .NET host applications with Visio type libraries.

  • Visio 2003 Save as Web type library PIA: Facilitates saving of Visio documents as Web pages.

  • Visio 2003 ActiveX drawing control PIA: Facilitates use of ActiveX drawing control from the .NET host applications.




NET InstantCode. UML with Visio and Visual Studio .NET
NET InstantCode. UML with Visio and Visual Studio .NET
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 49

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