1
Answer

How to open third party exe file into windows form

Ask a question
Hello all,
 
I need to open third party .exe file inside windows form. I am using this code but it will open another new windows outside the form.
 
  1. [DllImport("user32.dll")]  
  2.  static extern IntPtr setParent(IntPtr hwc, IntPtr hwp);  
  3.   
  4. private void panel1_Paint(object sender, PaintEventArgs e)  
  5.         {  
  6.             Process p = Process.Start("notepad.exe");  
  7.             Thread.Sleep(5000);  
  8.             p.WaitForInputIdle();  
  9.             setParent(p.MainWindowHandle, this.Handle);  
  10.   
  11.         } 
Right now I am opening this notepad.exe in panel view but it will not open inside in form it will open in outside the form.
Please let me know how to do this.
Thanks in advance.
 

Answers (1)