DigitX32 |
|
| in pratica stai facendo riferimento all'articolo http://pasotech.altervista.org/delphi/articolo125.htmnon ho capito bene cosa vorresti cambiare comunque dovresti studiare il codice della StartApplication CODICE procedure TFormSample.StartApplication(name,classname,title : string); var i: integer; ptitle,pclassname: pchar; buf: array[0..255] of char; begin if hWndApplication <> 0 then PostMessage(hWndApplication,WM_QUIT,0,0);
//Carlo Pasolini : 21/07/08 if not ExecuteProcess(PChar(name), 0, False, True, SW_HIDE) then begin PanelApp.caption := format('failed starting of application %s ',[name]); exit; end; (*hApplication := WinExec(pchar(name),SW_HIDE); if hApplication < 32 then begin PanelApp.caption := format('application %s not found',[name]); exit; end;*)
if classname <> '' then pclassname := pchar(classname) else pclassname := pointer(0); if title <> '' then ptitle := pchar(title) else ptitle := pointer(0);
//Carlo Pasolini : 21/07/08 hWndApplication := FindWindow(pclassname,ptitle); if hWndApplication = 0 then Exit;
(*for i := 0 to 20 do begin hWndApplication := FindWindow(pclassname,ptitle); if hWndApplication <> 0 then break; sleep(100); end; *)
GetClassName(hWndApplication,buf,sizeof(buf)); labelClassName.caption:= buf;
SetMenu(handle,GetMenu(hWndApplication)); // Apply the applications menu to our form DrawMenuBar(handle); // Draw it if CheckBoxAsChild.checked then begin windows.SetParent(hWndApplication,PanelApp.handle); SetWindowLong(hWndApplication,GWL_STYLE,WS_CHILD); // Make the application a child end else windows.SetParent(hWndApplication,PanelApp.handle); // Move it to our panel ShowWindow(hWndApplication,sw_minimize); // finally, draw it ShowWindow(hWndApplication,SW_MAXIMIZE); // finally, draw it MoveWIndow(hWndApplication,0,0,PanelApp.width,PanelApp.height,FALSE); // Set it to the panels size InvalidateRect(hWndApplication,pointer(0),true); PanelAppResize(self);
end; fai delle prove sulle funzioni che vengono chiamate dopo la ExecuteProcess
|
| |