Why not just manually disable the parent form while the dialog is visible?  
That's pretty much all a modal dialog is really doing anyway.  If that's not 
enough, the SetParent win32 api function may also help.

Regards,

Nathan Keir
Systems Analyst
John Deere Financial Limited A.C.N. 078 714 646
Australian Credit Licence Number 391484
Incorporated in Queensland, Australia
166-170 Magnesium Drive, Crestmead, QLD, Australia 4132
PO Box 1544, Browns Plains BC, QLD, Australia 4118
+61 7 3802 3274 (office)
+61 7 3802 3142 (fax)
keirnat...@johndeere.com<mailto:namey...@johndeere.com>
www.JohnDeere.com.au<http://www.johndeere.com.au/>
CONFIDENTIALITY. This message, including attachments, may be confidential. If 
you believe this message was sent to you in error, do not read it. If you are 
not the intended recipient, any retention, dissemination, distribution, or 
copying of this communication is strictly prohibited. Please reply to the 
sender that you have received the message in error and delete it.

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On 
Behalf Of Greg Keogh
Sent: Wednesday, 14 December 2011 9:57 AM
To: 'ozDotNet'
Subject: VB6 calling modal .net dialog

Folks, I have a working .NET Form that runs fine as a modal dialog in managed 
apps, it's used to pick an item from a list and it returns the Int32 Id of the 
selected item. Now I have to make this dialog available to VB6. I've done 
plenty of Interop before to wrap managed library methods as ComVisible, but 
this is the first time I've tried this with a Window.Forms class.

I presume the VB6 caller can only pass me a HWND, so I ran a few experiments to 
see if I could convert a HWND from an NUnit test to an Owner of my dialog, but 
I can't figure that out. I then tried HWND to NativeWindow to ShowDialog(owner) 
on the caller side, but it doesn't run modal. It's not looking good so far.

I have a feeling I'm heading into a world of pain trying make the modal 
behaviour work with a VB6 caller. I can't get any definitive advice from web 
searches so far, so I thought I'd ask first to see if anyone has been there 
before.

Greg

Reply via email to