I would like to be able to show a non-modal form in an already existing application. At the moment I can do something like:
myform.ShowDialog(handleToApp);
I found what I was looking for, you have to make a class which looks like this:
public class MapinfoWindowHandle : System.Windows.Forms.IWin32Window
{
private IntPtr handle;
public MapinfoWindowHandle(IntPtr hWnd)
{
handle = hWnd;
}
#region IWin32Window Members
IntPtr System.Windows.Forms.IWin32Window.Handle
{
get { return handle; }
}
#endregion
}
and then you can do this:
IntPtr windowhandle = new IntPtr(hWnd);
MyForm.Show(new MapinfoWindowHandle(windowhandle));
How about a simple myForm.Show()
?