In VB6 the main window handle is actually a hidden window, so you'd need to
get the form's handle

|-----Original Message-----
|From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-
|boun...@ozdotnet.com] On Behalf Of Greg Keogh
|Sent: Wednesday, 14 December 2011 11:39 AM
|To: 'ozDotNet'
|Subject: RE: VB6 calling modal .net dialog
|
|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