Resize a .exe I started in a Windows Forms Panel?

T

timnels

I have been able to execute Notepad.exe in a Panel (set to Dock.Fill)
on a Windows Form, like:

ProcessStartInfo psi = new ProcessStartInfo("notepad");
p = Process.Start(psi);
p.WaitForInputIdle();
SetParent(p.MainWindowHandle, uiAppPanel.Handle);
ShowWindow(p.MainWindowHandle, (int)ShowCommands.SW_MAXIMIZE);
int style = GetWindowLong(p.MainWindowHandle, GWL_STYLE);
SetWindowLong(p.MainWindowHandle, GWL_STYLE, style & ~WS_CAPTION);

Only problem now when I resize the Form the Panel resizes, but I need a
way to tell Notepad to resize to fill the panel (maximize I guess)
also. I tried calling ShowWindow again, but that seems to have no
effect. Is it possible to make this work?
 
T

timnels

can i ask why you need to use notepad in this way? im curious

We need to host some old legacy windows applications within a new .Net
shell/menu application. I am just using notepad.exe as a test.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top