|DAVSL: Visio AddOn Framework for Delphi|
|Home Visio This page|
To add really sophisticated functionality to Visio, it's necessary to build VB, C++, Delphi or other language modules ("AddOns") to control Visio and respond to events triggered in Visio. While it's possible to do quite a bit of this in VBA, one shortcoming is that VBA modules are housed in Visio documents, which leads to challenges about how to control when those documents are open and the projects accessible. In particular, it's obviously not possible for a VBA module to be modifying Visio's behavior when all documents are closed.
Hence in a lot of scenarios, it is more manageable to build the additional functionality as an external module.
One form which that external module can take is a stand-alone executable (xxx.exe). These can be built in a variety of languages including VB. For many applications this works fine. However, there are several reasons why you might prefer to build the external module as a DLL callable by Visio, which is refered to as a "VSL" (Visio Solution Library):
Of the two languages that Visio has provided development materials for, VB can't generate a suitable VSL-style DLL, so that means developers have been constrained to using C++ to develop VSLs. The special requirements of a VSL are few compared to a regular DLL, yet, despite examples in "Developing Visio Solutions" many developers have found the process daunting because it requires mastering a number of issues which are relatively advanced uses of C++, including building and debugging a DLL, and mastering use of COM Automation from C++.
For those so inclined, Borland Delphi represents a nice alternative:
However, Delphi developers have been stalled for want of a suitable starting framework, and in trying to translate the various aspects of the C++ DVS material supplied with Visio.
I hope the DAVSL framework presented here goes a long way to get Delphi-savvy developers unstuck. I have decided to go beyond simply translating Visio's C++ units. Instead it makes sense to provide a more complete foundation which supports a number of the features that VSLs customarily need, and organize it in an object-oriented fashion. A minimal VSL can be created with you providing a unit that is as brief as:
uses SysUtils, classes, DAVAO, DAVSL;
TAddOnBeepBeep = class(TAddOn)
function vlm_RUN(V2LRec: PVAOV2LRecord; Args: TStringList): TVAORC; override;
VAO_AOATTS_ISACTION OR VAO_AOATTS_HASABOUT , // atts
VAO_ENABLEALWAYS , // enabMask
0 , // invokeOnMask
0 , // notifyOnMask
'DAVSLBeep_Beep' , // lpName
'Minimal demo AddOn, simply beeps twice when called.'
TAddOnBeepBeep.vlm_RUN(V2LRec: PVAOV2LRecord; Args: TStringList): TVAORC;
In more detail:
In short, a minimal VSL can be set up with only a few lines of code, and can be expanded upon without excessive mental distress.
These DAVSL pages and the associated DAVSL framework source code may be used freely without charge. However, I would appreciate a mention in documentation or About box if you find them useful and deploy them in your own projects. Please also note the contributions of others (see below) when assigning credit. Thanks!
The first Delphi VSL-specific code I am aware of was a Delphi 2 VSL framework for Visio 4, by folks at The Diagrammatic Programming Corporation (involved in some interesting work quite apart from VSLs!) .
Recently Iwan C. van Ee of Ravelin contacted me enquiring about Delphi VSL code, and I relayed the by that time somewhat outdated Diagrammatic Programming VSL framework. A few weeks later Iwan returned to me their faithful Delphi translation of the Visio 2000 VAO library. This got me thinking about how to make the job a little easier and more Delphi-oriented, resulting in what we have here.
Article Created: 2000-09-20 Last edit: Last edit: 00-10-30 Graham Wideman
Go to: DiagramAntics.com