Windows Develop Bookmark and Share   
 index > Windows Forms Designer > [solved] Display a designer form in an external application without freezing external application events
 

[solved] Display a designer form in an external application without freezing external application events

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

Hi.

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!
  • Edited byJason-T Monday, January 26, 2009 9:59 PM
  •  
Jason-T  Monday, January 26, 2009 9:19 AM
This forum is for Visual Studio's form designer, not for code you wrote. But I see no reason you need to call Application.Run from a DLL. Detail what you intend to do in the Windows Form forum and I am sure experts there will come up with a better approach.


MSMVP VC++
Sheng Jiang 蒋晟  Monday, January 26, 2009 9:06 PM
This forum is for Visual Studio's form designer, not for code you wrote. But I see no reason you need to call Application.Run from a DLL. Detail what you intend to do in the Windows Form forum and I am sure experts there will come up with a better approach.


MSMVP VC++
Sheng Jiang 蒋晟  Monday, January 26, 2009 9:06 PM

You can use google to search for other answers

Custom Search

More Threads

• Gradient Panel
• Form Size
• Query in Datagrid
• designer reloads
• Drive Mapping
• Need Image Control With SubImages
• Sometimes, my forms can't be opened in Designer because '08 no longer treats them as Forms/UserControls
• Designer Serialization (SplitContainer, third parties etc.)
• Mdi form
• A component does not recognize if it is in design mode!, a bug?