Hi all,
I am trying to develop an application which lunch extern programs and display them in another form.
I am doing that because my application will be able to communicate with several special bio-medical captors and captors' data can be read only with their own software.
It will be more convenient for the user to lunch one application.
So here is my code (extern process is adobe reader):
This code works properly but not with all software. I don't understand!
In some case the extern process isn't "eaten" by my panel! And user32 function like MoveWindow or SetWindowPos doesn't work!
Maybe I'm wrong but I believe that it appears when the extern software starts with its own window maximazed (full screen sizing).
Thanks in advance!
Goddet.
I am trying to develop an application which lunch extern programs and display them in another form.
I am doing that because my application will be able to communicate with several special bio-medical captors and captors' data can be read only with their own software.
It will be more convenient for the user to lunch one application.
So here is my code (extern process is adobe reader):
Code:
IntPtr PgmExtHandle = new IntPtr(0);
Process p= null;
ProcessStartInfo info = new ProcessStartInfo("AcroRd32.exe");
info.WorkingDirectory = targetDir;
info.WindowStyle = ProcessWindowStyle.Normal;
info.CreateNoWindow = false;
p = Process.Start(info);
Thread.Sleep(2000);
//Name of extern process
string lpszParentClass = "AcroRd32";
//Name of extern window
string lpszParentWindow = "Adobe Reader";
PgmExtHandle = FindWindow(lpszParentClass,lpszParentWindow);
//this line works too :
//PgmExtHandle = Process.GetProcessesByName("AcroRd32")[0].MainWindowHandle;
SetWindowPos(PgmExtHandle, new IntPtr(-2), 0, 0, myPanel.Width, myPanel.Height, SWP_SHOWWINDOW);
SetParent(PgmExtHandle, myPanel.Handle);
In some case the extern process isn't "eaten" by my panel! And user32 function like MoveWindow or SetWindowPos doesn't work!
Maybe I'm wrong but I believe that it appears when the extern software starts with its own window maximazed (full screen sizing).
Thanks in advance!
Goddet.