What event is fired when stencil window is closed?

B

Brian

I'm writing a VB.Net app with the 2003 drawing control and I'm trying to determine when the stencil (shapes) window is closed so I can uncheck my custom menu. To determine if the stencil window is opened I use the following loop in Form_Load, which works great

Dim win As Microsoft.Office.Interop.Visio.Windo
Dim isOpen As Boolean = Fals

'Loop through the windows, if the shapes is shown then set the toggl
For Each win In visApp.ActiveWindow.Window
If win.ID = VisWinTypes.visWinIDStencilExplorer The
isOpen = Tru
End I
Nex

ViewStencil.Checked = isOpe

If the user closes the window I'd like to know. I've tried putting breakpoints and messageboxes in the following events and when I close the stencil explorer I don't receive a messagebox or hit breakpoints from any of them (I do with all the other windows, such as the size/pos etc). I can't find any window close events on the page object
visApp_BeforeWindowClose
visWindow_BeforeWindowClose
visApp_QueryCancelWindowClos
visWindow_QueryCancelWindowClos

Help is much appreciate

Bria
 
D

dani

Hi Brian,

because the stencil is also a document, the events related with closing
a document (BeforeDocumentClose, QueryCancelDocumentClose) are fired.

Daniel
 
D

dani

I just checked with the Visio Event Monitor which comes with the Visio
2002 SDK...

the QueryCancelDocumentClose event is not fired.

but... these two events are fired:

BeforeWindowClose
BeforeDocumentClose

You can try to use the event monitor of the Visio 2002 SDK, although you
have Visio 2003. Maybe it works. This tool shows you all events that are
fired.

Daniel
 
B

Brian

Thanks for the reply. Unfortunately there is no BeforeWindowClosed event on the document object in 2003. There is a BeforeDocumentClose but this event isn't fired when the shapes window (document?) is closed. I've basically trapped the BeforeWindowClose and BeforeDocumentClose on the Application, Document, and Window objects (where supported) and nothing fires when the Shapes Window is closed. The Page object doesn't have any events related to windows closing

I'll try your suggestion of the event monitor. Does anyone know if the 2002 SDK will work on 2003

Thanks again
Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top