Show form from console app

  • Thread starter Thread starter Lars von Wedel
  • Start date Start date
L

Lars von Wedel

Hello,

I have developed a COM component (using interop) which is hosted by a
console application (no message loop).

Within a call to the component I want to display a form. However, the
application gets stuck in the call to form.Show(): no form is shown and
the call never returns.

Any ideas? What else could I try?

Lars
 
Hello,
Use Application.Run(new myForm()) This starts the message loop for the
application and shows the form.

I have no access to the source code of the console application. The console
app just calls a method of my COM component and I currently do a
form.ShowDialog().

Do you suggest to perform Application.Run within the plugin component?

Lars
 
Hmm, I see. Maybe you should create a Windows Form that hosts this COM
component.

Add the component as a reference, you'll get an interop asssembly generated.
Drag the control onto your form and set it to dock-fill or limit the form
size to the size of the control then do application.Run(....) on the form
you created.


--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com
 
Back
Top