I need to show a modeless dialog in .NET 1.1. The following code works in .NET 2.0 or higher:
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern IntPtr GetActiveWindow();
private void ShowModelessOwnedDialog()
{
IntPtr wHnd = GetActiveWindow();
NativeWindow parent = NativeWindow.FromHandle(wHnd);
MyForm f = new MyForm();
f.Show(parent);
}
The call Show(IWin32Window) was introduced in .NET 2.0. Do you know how to trick this code to work in .NET 1.1? Maybe any unmanaged call?
This is the way to assign an owner to a managed form in .NET 1.1. I extracted the following code from @Dave Markle answer and the
Show(IWin32Window)implemantation of .NET 2.0.