0

I'm trying to open a exe in a form with below code.

This is open my program but outside the form.I want to have this program inside of my form. Please Help Regards

Process p = new Process();

p.StartInfo.FileName = @"C:\Program Files\Cadence Design Systems\Allegro Free Physical Viewers 16.6\tools\pcb\bin\allegro_free_viewer";
p.StartInfo.Arguments = "ProcessStart.cs";
p.Start();
p.WaitForExit();
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
3
  • 1
    what does "have this program inside of my form" mean? Commented Feb 8, 2013 at 11:03
  • Why does it need to open 'inside' your form? Commented Feb 8, 2013 at 11:05
  • Hi, I create form in C# then I want to execute the alegroo program but the program to be opened inside of my form. Commented Feb 8, 2013 at 11:25

2 Answers 2

2

You can not run other application within your application using process, you can do it with Object Linking and Embedding and the application you want to open from within your application should be complaint with ole. This codeproject article explains how you can embed acrobat document within c# application.

Sign up to request clarification or add additional context in comments.

Comments

-1

If what you're saying is that you want to have a window inside your Windows Form application, this isn't easily possible.

Your best bet would be to setup an MDI Host Window, and use the WinAPI FindWindow and SetParent to find the external process window (once started), and set the parent of this window to your own form host window.

Something like this (after importing the methods) should work:

Process p = new Process();

p.StartInfo.FileName = @"C:\Program Files\Cadence Design Systems\Allegro Free Physical Viewers 16.6\tools\pcb\bin\allegro_free_viewer.exe";
p.StartInfo.Arguments = "ProcessStart.cs";
p.Start();
var handle = FindWindow(null, "allegro_free_viewer.exe");
SetParent(handle, this.Handle);
p.WaitForExit();

Of course, the better way is to see if the application is able to provide an ActiveX / OLE control that you're able to embed into your application, rather than using an external process.

1 Comment

-1 for a solution that actually would allow him to embed an application in his own?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.