Author Topic: Can't add anchored window  (Read 4860 times)

0 Members and 1 Guest are viewing this topic.


  • Jr. Member
  • **
  • Posts: 11
Can't add anchored window
« on: April 29, 2008, 08:33:31 AM »

I am writing a C# Visio COM-AddIn for visio 2007 using Visual Studio 2005.

I am trying to add an anchored window using the Windows.Add method, but I can only choose VisWinTypes.visStencilAddon as a type. All other types always result in the exception "Invalid window type for this action".

When the type is VisWinTypes.visStencilAddon, a window does appear (no exception).

The code that throws the exception is

Window visioWindow = vsoApplication.Windows.Add(
VisWindowStates.visWSAnchorLeft |
VisWindowStates.visWSAnchorAutoHide |
,55, 55, 100, 100, null, null, null);

I have tried many variations with the argumets, but when VisWinTypes is not visStencilAddon, the exception occures.
It is possible that the problem is not with the VisWinType, but with the other argumets. I just don't know.

Any ideas ?


Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1718
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Can't add anchored window
« Reply #1 on: April 29, 2008, 08:45:45 AM »
Hi "I"...

The anchor windows need to anchor to a document window, so I believe you are still one level too high. Try something like this:


Your code was trying to add a window to the application's window - ie: the main Visio window.

Does that make any sense?
For articles, tips and free content, see the Visio Guy Website at
Get my Visio Book! Using Microsoft Visio 2010


  • Jr. Member
  • **
  • Posts: 11
Re: Can't add anchored window
« Reply #2 on: April 30, 2008, 01:18:28 AM »
It works! the exception is no longer there and an anchored window does appear.
Many thanks for the quick reply.
« Last Edit: May 06, 2008, 05:59:02 AM by Visio Guy »