![]() |
Visio 2003 Developer's Survival Pack Tools and Samples |
Chapter 23: Exe Solutions (VS.NET C#) | |
![]() ![]() |
Filename | Description | Installation |
ch23_Exes.sln | Main Solution file which contains the one project CSReflectArgs | |
CSReflectArgs.exe | Simple Exe displays arguments passed to it by Visio, and also shows how to write to the drawing page. | Place CSReflectArgs.exe in a directory where
Visio will look for Addons: Visio 2002 and before: in a
subdirectory of the Solutions in the Visio installation directory. Coordinate with Tools > Options > Advanced > File Paths > Addons |
CSReflectArgs.vdx | Sample document to demo calling the CSReflectArgs Addon. | |
Remaining CSReflectArgs.* | C# project to build CSReflectArgs.exe |
Suggestions on how to operate are found on the drawing..
The main tricks on this sample are:
Concept | Note |
Include Visio namespace | In the Project Explorer, add a Reference to the
COM library : "Microsoft Visio 11.0 Type Library". For ease of use, add: using Visio = Microsoft.Office.Interop.Visio; |
Command line arguments | Modify the signature of the Main procedure to
accept an array of strings (see the Args[] argument).
You will likely want to save these for later use by the rest of the app. In this sample I show hw to write these strings to a variable in the Form (actually into one of the form's controls) and also in a static variable. (Note that Main is a static procedure.) |
Connecting to running Visio instance. | using System.Runtime.InteropServices; [..] VisApp = (Visio.Application) Marshal.GetActiveObject("visio.application"); |
Article Created: 2003-09-01 Last edit: Last edit:
03-10-15 Graham
Wideman
Go to:
DiagramAntics.com