cleaning up IWin32Window

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
 
M

Mattias Sjögren

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?

No



Mattias
 

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