private void OnLoaded(object sender, System.Windows.RoutedEventArgs e)
{
WindowsFormsHost FormsHost = new WindowsFormsHost();
Panel = new System.Windows.Forms.Panel();
FormsHost.Child = Panel;
AddChild(FormsHost);
this.Process = new Process();
this.Process.StartInfo = StartInfo;
this.Process.Exited += OnProcessExited;
this.Process.Start();
//this.Process.StartInfo.CreateNoWindow = true;
this.Process.EnableRaisingEvents = true;
this.Process.WaitForInputIdle();
Thread.Sleep(WaitTimeout);
NativeMethods.SetParent(Process.MainWindowHandle, Panel.Handle);
// remove control box
int style = NativeMethods.GetWindowLong(Process.MainWindowHandle, GWL_STYLE);
style = style & ~WS_CAPTION & ~WS_THICKFRAME;
NativeMethods.SetWindowLong(Process.MainWindowHandle, GWL_STYLE, style);
// resize embedded application & refresh
ResizeEmbeddedApp();
}