Microsoft KB Archive/931403

= A stencil opens in only the first instance of the Visio Drawing Control when you use the OpenEx method on a form that contains multiple instances of the Visio Drawing Control =

Article ID: 931403

Article Last Modified on 10/15/2007

-

APPLIES TO


 * Microsoft Office Visio Standard 2007
 * Microsoft Office Visio Professional 2007
 * Microsoft Office Visio Professional 2003
 * Microsoft Office Visio Standard 2003

-



SYMPTOMS
You create a custom application that uses more than one Microsoft Office Visio Drawing Control on a form. When you use the OpenEx method together with the visOpenDocked flag to open a stencil, the stencil is opened in only the first instance of the Visio Drawing Control on the form. You cannot open the stencil in all instances or in a particular instance of the Visio Drawing Control.

For example, you experience these symptoms when you use the following code to open the Basic Shapes stencil: axDrawingControl1.Document.Application.Documents.OpenEx(&quot;Basic_U.vss&quot;,(short)Visio.VisOpenSaveArgs.visOpenDocked); axDrawingControl2.Document.Application.Documents.OpenEx(&quot;Basic_U.vss&quot;,(short)Visio.VisOpenSaveArgs.visOpenDocked);



CAUSE
The OpenEx method together with the visOpenDocked flag creates a docked stencil window in an active window if the active window is a drawing page window. An instance of the Visio application can only have one active multiple document interface (MDI) window at a time. Multiple instances of the Visio Drawing Control share the same underlying application instance. In this scenario, each instance of the Visio Drawing Control can be regarded as a MDI window.



RESOLUTION
Specify the instance or instances of the Visio Drawing Control that you want to use as the active window. To do this, set the focus on the control object or objects before you use the OpenEx method together with the visOpenDocked flag to open a stencil.

The following is an example of code that opens the Basic Shapes stencil in two instances of the Visio Drawing Control: axDrawingControl1.SetFocus; axDrawingControl1.Document.Application.Documents.OpenEx(&quot;Basic_U.vss&quot;,(short)Visio.VisOpenSaveArgs.visOpenDocked); axDrawingControl2.SetFocus; axDrawingControl2.Document.Application.Documents.OpenEx(&quot;Basic_U.vss&quot;,(short)Visio.VisOpenSaveArgs.visOpenDocked);



MORE INFORMATION
For more information about the Visio Drawing Control in Visio 2007, see the Microsoft Office Visio 2007 Software Development Kit (SDK). To obtain the Visio 2007 SDK, visit the following Microsoft Web site:

http://www.microsoft.com/downloads/details.aspx?FamilyID=373D34B8-5EF7-4E6E-A582-C8D6B5EE4E33&amp;displaylang=en

For more information about the Visio Drawing Control in Visio 2003, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/aa173161(office.11).aspx

Additional query words: vso2003 visio2003 vso2007 visio2007 activeX

Keywords: kbtshoot kbprogramming kbprb kbexpertiseinter KB931403

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.