Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert applications to another form

Status
Not open for further replies.

goddet

Programmer
Nov 7, 2007
1
FR
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):
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);
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top