Sorry, I missed the NativeWindow bit.

I have some other code for doing this (my scenario, native window, out of
process) with WPF windows which is a little different and uses
WindowInteropHelper and the SetWindowLong Win32 API function (because using
just WindowInteropHelper doesn't give modal behaviour).

I'm not sure why my code uses SetWindowLong instead of SetParent like
Nathan suggested.

On Wed, Dec 14, 2011 at 10:38 AM, Greg Keogh <[email protected]> wrote:

> Matt, I tried something similar with an nunit test, like this:****
>
> ** **
>
> IntPtr hwnd = System.Diagnostics.Process
> .GetCurrentProcess().MainWindowHandle;****
>
> var win = new NativeWindow();****
>
> win.AssignHandle(hwnd);****
>
> var picker = new MyPicker();****
>
> var result = picker.ShowDialog(win);****
>
> ** **
>
> I was hoping that this would set the nunit app window to be the owner of
> the ShowDialog, but sadly two things go wrong: (1) It’s not modal, but that
> might be a quirk with using the nunit window (2) The dialog doesn’t appear
> in the CenterParent position, it goes to screen top-left.****
>
> ** **
>
> Greg****
>
> ** **
>

Reply via email to