What is the best way to "dock" a third party application running inside the windows.forms panel?

I am currently doing it this way:


// _Container is the panel that the program is to be displayed in.

System.Diagnostics.Process procTest = new System.Diagnostics.Process();
procTest.StartInfo.FileName = "TEST.EXE";
procTest.StartInfo.CreateNoWindow = false;
procTest.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
procTest.Start();

procTest.WaitForInputIdle();
SetParent(procTest.MainWindowHandle, _Container.Handle);
MoveWindow(procTest.MainWindowHandle, 
           0, 0, _Container.Width, _Container.Height, true);

      


The problem with this code is that some parts of the app's UI no longer function as expected as soon as I change the MainWindowHandle (i.e. the buttons skip text).

Is there a way to do this without causing problems with the docked app? (Either via .net or user32)?

+2


source to share


1 answer


First of all, instead of just waiting 1.5 seconds, try calling procTest.

WaitForInputIdle

to wait for his message, the loop is free.
You are already there.

In general, I don't think it can be done without modifying the program you are hosting.



EDIT . You can try to keep another program above your hosting area by hiding from the taskbar, removing its title, moving it as your program moves, etc. However, this still won't work perfectly; I recommend that you try to find an alternative.

Try to contact the original developers of the third party app and ask their advice.

+1


source







All Articles