Hi I'm trying to reuse some code i was pointed to earlier to run a 3rd party .exe inside of a my winform
the code i was given was
via Mr. Greg Young
public class Native {
[DllImport("user32.dll", SetLastError = true)]
private static extern uint SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
public static void LoadProcessInControl(string _Process, Control _Control)
{
System.Diagnostics.Process p = System.Diagnostics.Process.Start(_Process);
p.WaitForInputIdle();
Native.SetParent(p.MainWindowHandle, _Control.Handle);
}
}
where it execution would be
public partial class Form1 : Form {
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
LoadProcessInControl("notepad.exe", this.splitContainer1.Panel1);
LoadProcessInControl("notepad.exe", this.splitContainer1.Panel2);
}
}
However I keep getting "The name 'LoadProcessInControl' does not exist in the current context"
Scope of classes is still a weak point in my programing knowledge and I'm hoping to understand it a little better.
Ive tried switching the class to public and removing static from the method (load procincontrol) but I'm not getting anywhere)
Thanks for your help