C
Craig Eddy
The ConnectionsAdded event seems to work on my development machine. It
doesn't work at all on machines with only Visio 2003, .NET Framework,
and my app installed. If I manually call my AdviseEvents method I can
sometimes get the event to fire ONCE, but only once. Here's my
AdviseEvents method:
System.Diagnostics.Trace.WriteLine( "ProjectVisioWindow.AdviseEvents
called..." );
MessageBox.Show("AdviseEvents called");
axDrawingControl1.Window.Application.ConnectionsAdded += new
Microsoft.Office.Interop.Visio.EApplication_ConnectionsAddedEventHandler(Application_ConnectionsAdded);
axDrawingControl1.Window.Application.ConnectionsDeleted += new
Microsoft.Office.Interop.Visio.EApplication_ConnectionsDeletedEventHandler(Application_ConnectionsDeleted);
axDrawingControl1.Window.Application.BeforeShapeDelete += new
Microsoft.Office.Interop.Visio.EApplication_BeforeShapeDeleteEventHandler(Application_BeforeShapeDelete);
axDrawingControl1.Document.Application.ConnectionsAdded += new
Microsoft.Office.Interop.Visio.EApplication_ConnectionsAddedEventHandler(Application_ConnectionsAdded);
axDrawingControl1.Window.Application.Documents.ConnectionsAdded +=
new Microsoft.Office.Interop.Visio.EDocuments_ConnectionsAddedEventHandler(Application_ConnectionsAdded);
In response to a menu item click, my application creates a new modal
form which contains the drawing control. I have placed calls to the
above code in as many places as I can think of. What am I missing?
I've also tried using EventList.AddAdvise to add this event, but I get
nothing but exceptions from that. I used the following code, called
against just about every EventList I could find:
connectsEventSink = new
ConnectsAddedEventSink(axDrawingControl1.Window.Application.ActivePage);
try
{
axDrawingControl1.Window.Application.EventList.AddAdvise(
(unchecked( (short) visio.VisEventCodes.visEvtAdd ) + (short)
visio.VisEventCodes.visEvtConnect),
connectsEventSink, "", "connect event");
}
catch( Exception )
{
System.Diagnostics.Trace.WriteLine(" Window.Application.EventList
didn't work ");
}
Does ANYONE have a reliable way to connect to this event or any clue
as to why it would work on my dev machine but not a target machine?
The ShapeAdded event seems to work just fine no matter where I run.
Thanks in advance,
Craig
doesn't work at all on machines with only Visio 2003, .NET Framework,
and my app installed. If I manually call my AdviseEvents method I can
sometimes get the event to fire ONCE, but only once. Here's my
AdviseEvents method:
System.Diagnostics.Trace.WriteLine( "ProjectVisioWindow.AdviseEvents
called..." );
MessageBox.Show("AdviseEvents called");
axDrawingControl1.Window.Application.ConnectionsAdded += new
Microsoft.Office.Interop.Visio.EApplication_ConnectionsAddedEventHandler(Application_ConnectionsAdded);
axDrawingControl1.Window.Application.ConnectionsDeleted += new
Microsoft.Office.Interop.Visio.EApplication_ConnectionsDeletedEventHandler(Application_ConnectionsDeleted);
axDrawingControl1.Window.Application.BeforeShapeDelete += new
Microsoft.Office.Interop.Visio.EApplication_BeforeShapeDeleteEventHandler(Application_BeforeShapeDelete);
axDrawingControl1.Document.Application.ConnectionsAdded += new
Microsoft.Office.Interop.Visio.EApplication_ConnectionsAddedEventHandler(Application_ConnectionsAdded);
axDrawingControl1.Window.Application.Documents.ConnectionsAdded +=
new Microsoft.Office.Interop.Visio.EDocuments_ConnectionsAddedEventHandler(Application_ConnectionsAdded);
In response to a menu item click, my application creates a new modal
form which contains the drawing control. I have placed calls to the
above code in as many places as I can think of. What am I missing?
I've also tried using EventList.AddAdvise to add this event, but I get
nothing but exceptions from that. I used the following code, called
against just about every EventList I could find:
connectsEventSink = new
ConnectsAddedEventSink(axDrawingControl1.Window.Application.ActivePage);
try
{
axDrawingControl1.Window.Application.EventList.AddAdvise(
(unchecked( (short) visio.VisEventCodes.visEvtAdd ) + (short)
visio.VisEventCodes.visEvtConnect),
connectsEventSink, "", "connect event");
}
catch( Exception )
{
System.Diagnostics.Trace.WriteLine(" Window.Application.EventList
didn't work ");
}
Does ANYONE have a reliable way to connect to this event or any clue
as to why it would work on my dev machine but not a target machine?
The ShapeAdded event seems to work just fine no matter where I run.
Thanks in advance,
Craig