Hosting EXE Application in a Winform?

  • Thread starter Thread starter Kevin
  • Start date Start date
Hi!
It's possible to Host a exe application in a winform?

Thanks

Hi Kevin,
Whether you want a new EXE to be started form your Form
or execute it inside your form.

If you want to just execute external EXE, then you can
always use the Process class.

Thanks,
coolCoder
 
Hello Kevin,
I also want to run an external application and show it in a windows .net
form. Unfortunally the link to codeproject doesn't work. Can you reply me the
article please or do you have an example for me ?

Thanks for that,

Erwin
 
using System.Threading;

private void Startnewformthread()
{
frmMyform frm = new frmMyform();
frm.Show();
//here do a loop while the form exist, just be sure to put a
DoEvents
//and a certain pause timer to not make it run 100000 times per
second
//for sleep use this : System.Threading.Thread.Sleep(1000);
//1000 = 1 second
}

somewhere in the code

Thread t = new Thread(new ThreadStart(Startnewformthread));
t.Start();
 
Hi,

Franck said:
using System.Threading;

private void Startnewformthread()
{
frmMyform frm = new frmMyform();
frm.Show();
//here do a loop while the form exist, just be sure to put a
DoEvents
//and a certain pause timer to not make it run 100000 times per
second
//for sleep use this : System.Threading.Thread.Sleep(1000);
//1000 = 1 second
}

somewhere in the code

Thread t = new Thread(new ThreadStart(Startnewformthread));
t.Start();

You shouldn't run your own message loop on a seperate thread. If you
want two or more independent message loops, use Application.Run(frm) on
the appropriate thread.

Also make sure to not access any control on another thread without an
appropriate call to Control.Invoke().

Best regards,
Martin
 
Back
Top