Author: Jonas Bilinkevicius
How do I open an executable in a determined form's area? Example: Open an
executable and show it on the left forms part with a size of 400 x 300.
Answer:
This works for me. Keep in mind that some apps have their startup settings set
somewhere which may override the Startup structure you pass.
1 procedure TForm1.Button1Click(Sender: TObject);
2 var3 StartupInfo: TStartupInfo;
4 ProcessInfo: TProcessInformation;
5 begin6 FillChar(StartupInfo, Sizeof(StartupInfo), #0);
7 StartupInfo.cb := Sizeof(StartupInfo);
8 StartupInfo.dwFlags := STARTF_USEPOSITION or STARTF_USESIZE;
9 StartupInfo.wShowWindow := SW_SHOWNORMAL;
10 StartupInfo.dwX := Left;
11 StartupInfo.dwY := Top;
12 StartupInfo.dwXSize := 400;
13 StartupInfo.dwYSize := 300;
14 CreateProcess(nil, 'yourapp.exe', nil, nil, false, CREATE_NEW_CONSOLE or15 NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo);
16 end;