C and C++ Library Files for Visio 2002 Download
Collapse the table of content
Expand the table of content

C and C++ Library Files for Visio 2002 Download

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Microsoft Corporation

October 2001

Applies to:
   Microsoft Visio 2002

Summary: Use these C and C++ library and sample files to create your Microsoft Visio 2002 solutions.

Download C-CPP.exe.


Sample Files
Using this Download
Library files included in vao_src and vao_inc
Sample Project and Files in the Samples Folder

Sample Files

These files are the updated versions of the Developing Visio Solutions C-CPP files that used to ship with the Microsoft ® Visio ® product.

The files include Visio wrapper and helper classes, Visio constant definitions, and source and include files for your C and C++ based Visio solutions.

Use these files to:

  • Create Visio VSLs
  • Work with Visio events
  • Work with the Visio object model
  • Create Visio COM add-ins

Using this Download

The C-CPP directory contains files to assist in the development of C or C++ programs that control Visio using Automation (formerly OLE Automation). The files contained in the voa_src and voa_inc folders are re-usable library files. The samples folder provides several simple example add-ons that use these files.

A C or C++ add-on can be created as an executable or as a Visio Library (VSL). VSLs are DLLs with a special exported entry point for Visio called VisLibMain. Because VSLs are loaded in the Visio instance process space, they run faster than executable add-ons. For Visio to recognize a VSL, it must have the extension .vsl and reside in the Visio add-ons path or the Visio start-up path. Both paths can be changed in the File Paths tab of its Options dialog box (on the Visio toolbar, select Tools, and then click Options).

Library files included in vao_src and vao_inc

The vao_inc folder contains header files and the vao_src folder contains the related source files.


This file contains all of the Visio interface definitions. Each of the object's properties and methods is declared using STDMETHOD in the scope of the DECLARE_INTERFACE_ block. Using STDMETHOD dictates that every property and method returns an HRESULT. Look in the example code to see how this HRESULT is used.


This file contains a C++ wrapper class for each dual interface declared in VISIO.h. The main purpose of the wrapper classes is to keep track of the COM AddRef and Release in the class constructors, destructors, and assignment operators.


This pair of files provides wrapper classes for COM Data types, VARIANT, BSTR, and SafeArray that can be used with the interface wrappers defined in VISIWRAP.h.


This pair of files provides useful functions for getting and creating instances of Visio. IVISREG.cpp contains the same functions for use with C and C++. To use it, add IVISREG.cpp to your project and include IVISREG.h after you include VISIWRAP.h.


VAO.c contains the supporting functions for running as a VSL. It contains VAOUtil_DefVisMainProc and VAOUtil_RegisterAddons which can be used by the VSL to register its add-ons with Visio.


One important thing to remember is that VSLs are just DLLs with a special entry point. This file contains the standard routines needed by a DLL.


These files provide helper classes for creating Visio Sink objects and working with the IVisEventProc interface. See the generic sample for an example that uses this file.


This pair of files should be used to create both VSL and executable add-ons in C++. They provide a class called Vaddon which acts as an add-on manager superclass. VADDON.cpp provides an implementation of the exported entry point for VSL add-ons, VisLibMain, which calls VAddon methods. To create new add-ons in C++, include these files in your project and derive classes from VAddon. For executable add-ons that use these files, also add a compiler define to the project. See VADDON.cpp for more details.

Sample Project and Files in the Samples Folder

The samples folder provides the Visio template and stencil that are used by the Generic and Generic MFC samples. Each sample folder contains a Visual C++ version 6 project file that can be compiled to create a VSL. To run the add-ons with Visio, you will need to update the Visio add-ons folder to include the path for the add-ons. To open the sample stencil and template files in the two generic samples, you will also need to update the Visio template and stencil paths. To do so, start Visio and on the Tools menu, click Options. In the Options dialog box, go to the File Paths tab to change the paths. Once the file paths have been updated and the add-ons have been built, they will be available from the Tools > Macros menu item unless you are running in developer mode in which case they will appear in Tools > Add-ons.

Generic Sample Folder

This sample provides code to create a simple add-on which opens a Visio template and stencil, drops several shapes on the page, and connects them. It also shows how to work with events using the classes in ADDSINK.h and ADDSINK.cpp.

This folder now contains LIB.c and MAIN.c. In previous versions, these files were included in the voa_src folder but, unlike other files in that folder, they are not reusable library files. In the generic sample, LIB.c provides an implementation for VisLibMain and should be used to create an add-on VSL, and MAIN.c should be used to create an add-on executable.

Generic MFC Sample Folder

This sample provides an MFC add-on with the same functionality as the Generic add-on. This example uses the implementation of VisLibMain in VADDON.cpp and shows how to derive a class from Vaddon.

MyAddon Sample Folder

This provides a simple example of publishing multiple add-ons names from the same VSL. The add-ons in this sample use the same sub-class of the Vaddon class but you can also have multiple sub-classes of Vaddon in the same VSL.

Additional Information

  • Developing Microsoft Visio Solutions has a chapter titled "Programming Visio with C” that discusses how Visio exposes objects to Automation in terms of COM, describes basic support services provided by Visio, and explains how to develop a VSL.
© 2015 Microsoft