Running .exe gui in a windows form container

  • Thread starter Thread starter Gerry
  • Start date Start date
G

Gerry

I need to display two VB6 applications side by side within a single
'windows manager'

My thought is that I could use a split screen form, using the 2.0
framework and visual studio 2005, that display the UI of each of the
VB6 apps within some control or container on the windows form.

The obvious solution is to rebuild the VB6 apps as com objects and
place the com objects on the form. Is there a solution that doesn't
require me to rebuild the VB6 apps?
 
Something like this ??

namespace WindowsApplication2

{

public partial class Form1 : Form {

public Form1()

{

InitializeComponent();

}

private void LoadProcessInControl(string _Process, Control _Control)

{

System.Diagnostics.Process p = System.Diagnostics.Process.Start(_Process);

p.WaitForInputIdle();

Native.SetParent(p.MainWindowHandle, _Control.Handle);

}

private void Form1_Load(object sender, EventArgs e)

{

LoadProcessInControl("notepad.exe", this.splitContainer1.Panel1);

LoadProcessInControl("notepad.exe", this.splitContainer1.Panel2);

}

}

public class Native {

[DllImport("user32.dll", SetLastError = true)]

public static extern uint SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

}

}
 
You are correct ... but the other alternative is the CreateDesktop route
which from what I understand which get extremely nasty and this works on
everything now.

Greg
 
Back
Top