1,221
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.Button1Click(Sender: TObject);
var
H1,H2: Hwnd;
begin
// 先執行要放入專案的外部EXE檔案(用隱藏方式來執行)
WinExec('C:\Program Files\TOOLS\MYIE\MyIE.exe',SW_HIDE);
// 再找到該外部EXE檔案
H1 := FindWindow(nil,PChar('MyIE'));
// 假設找到執行之程式後要放在 Panel1
H2 := Panel1.Handle;
// 將外部程式放在 Panel1
Windows.SetParent(H1,H2);
// 設定外部程式顯示的位置及大小
// MoveWindow(hWnd,X,Y,W,H,B) : RETURN BOOL
// hWnd: HWND
// X:Integer; {horizontal}
// Y:Integer; {vertical}
// W:Integer; {the new window width}
// H:Integer; {the new window height}
// B:BOOL; {the repaint flag}
MoveWindow(H1,0,0,Panel1.Width,Panel1.Height,True);
//
Windows.ShowWindow(H1,SW_ShowNormal);
end;