__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
AnsiString ligne_cmd = "K-Meleon\\k-meleon.exe";
AnsiString ligne_cmd_arg = ExtractFilePath(Application->ExeName) + "wwwBlocklyArduino\\index.html";
STARTUPINFO StartInfo; // name structure
PROCESS_INFORMATION ProcInfo; // name structure
memset(&ProcInfo, 0, sizeof(ProcInfo)); // Set up memory block
memset(&StartInfo, 0 , sizeof(StartInfo)); // Set up memory block
StartInfo.cb = sizeof(StartInfo); // Set structure size
int res = CreateProcess(NULL, ligne_cmd.c_str() , NULL, NULL, true, DETACHED_PROCESS, NULL,ExtractFilePath(Application->ExeName).c_str(), &StartInfo, &ProcInfo); // starts MyApp
if (res) WaitForInputIdle(ProcInfo.hThread, INFINITE);
// Supprime la barre de titre
SetWindowLong(ProcInfo, GWL_STYLE, GetWindowLong(ProcInfo, GWL_STYLE));
SetWindowPos(ProcInfo, 0, 0, 0, 0, 0, SWP_FRAMECHANGED); // Or SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER);
// Assigne et maximise le prog externe au conteneur (un panel ici)
SetParent(Panel1);
ShowWindow(Panel1, SW_MAXIMIZE);
}
Partager