procedure TForm1.Button2Click(Sender: TObject);
var
h: HWND;
begin
h := WIndows.FindWindow(nil, '你所要内嵌的程序的Caption ');
Windows.SetParent(h, Self.Panel1.Handle);
Windows.MoveWindow(h, 0, 0, 200, 200, true);
end;
我使用多线程的目标是减少桌面空间的占用。只需要运行一个多线程程序就可以了。但是,对于网站方面Cookies管理是个问题。
所以,用以上的代码写一个单线程管理多个程序,减少桌面空间的占用。一个点击最少化,其它的窗体也会隐藏。
转自:http://topic.csdn.net/t/20041030/09/3505314.html
uses shellapi;
procedure TForm1.Button2Click(Sender: TObject);
var hSndrec32: HWND;
begin
hSndrec32 := WIndows.FindWindow(nil, '声音 - 录音机 ');
if hSndrec32 <> 0 then
begin
Windows.SetParent(hSndrec32, Panel1.Handle);
Windows.MoveWindow(hSndrec32, 0, 0,panel1.Width,panel1.Height,true);
end
else
showmessage( '未发现该程序! ');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
shellexecute(handle, 'open ', 'sndrec32.exe ',nil,nil,sw_shownormal);
end;