Display a designer form in an external application without freezing external applicat – .NET Framework




I have created a dll in VC++ 08 that exports a CLR windows form class. I call into this dll from an external (closed source, third-party) application to instantiate the form and embed it into the external application window using SetParent(). The problem is, the form runs in the external application window, but the external application no longer updates (renders, responds to close button click, etc.).

Now I know the reason is that in order to keep the CLR form displayed, I had to use Application::Run(gcnew MyForm())–a selfish method that causes the form application to loop forever, not giving the external application a chance to process. How do I let the two windows be friends and share processing time?

I’m a ‘n00b’ at most of this, so please n00bify the answer for me. I won’t be offended if you explain it to me as if I were a 2-year-old, handicapped child. (Please do!) I’m thinking the obvious answer may be the use of threads, but I can’t seem to wrap my mind around the concept of threads (if that is even the answer). If there is a way to use Application::Run() and/or a custom form update loop, please enlighten me to one or both paths. (Code is greatly appreciated, of course.) Thanks!


Nevermind. I had to jump through a number of hoops, but I think everything is fixed now. Thanks.