G
Guest
First, apologies for cross-posting.
I'm writing a Visio add-in using the .NET Framework. The add-in displays a
number of windows forms as modal dialog boxes. In order to display
properly, I set the parent to the Visio Window. I've done this by creating
a class that implements IWin32Window. The Handle property returns the value
of the Visio Application's WindowHandle32 property. This is actually set
when I instantiate the class implementing IWin32Window. So the code looks
something like this:
using System;
using System.Windows.Forms;
using Visio = Microsoft.Office.Interop.Visio;
[System.Runtime.InteropServices.ComVisible(false)]
public class VisioWindow : IWin32Window {
private IntPtr m_hWnd;
public VisioWindow(Visio.Application app){
m_hWnd = new IntPtr(app.WindowHandle32);
}
public IntPtr Handle {
get {
return m_hWnd;
}
}
}
This is my question: when I'm destroying a form that sets the parent to the
Visio application window, do I need explicitly to release the IWin32Window?
If so, how? (FWIW, I fired up Lutz Roeder's .NET reflector and saw that
IntPtr wraps an [unmanaged] pointer.)
ernie b
I'm writing a Visio add-in using the .NET Framework. The add-in displays a
number of windows forms as modal dialog boxes. In order to display
properly, I set the parent to the Visio Window. I've done this by creating
a class that implements IWin32Window. The Handle property returns the value
of the Visio Application's WindowHandle32 property. This is actually set
when I instantiate the class implementing IWin32Window. So the code looks
something like this:
using System;
using System.Windows.Forms;
using Visio = Microsoft.Office.Interop.Visio;
[System.Runtime.InteropServices.ComVisible(false)]
public class VisioWindow : IWin32Window {
private IntPtr m_hWnd;
public VisioWindow(Visio.Application app){
m_hWnd = new IntPtr(app.WindowHandle32);
}
public IntPtr Handle {
get {
return m_hWnd;
}
}
}
This is my question: when I'm destroying a form that sets the parent to the
Visio application window, do I need explicitly to release the IWin32Window?
If so, how? (FWIW, I fired up Lutz Roeder's .NET reflector and saw that
IntPtr wraps an [unmanaged] pointer.)
ernie b