Close1('http://');
procedure TForm1.Close1(S:string);
var
h:hwnd;
begin
h:=form_hwnd(s);
if h<>0 then postMessage(h, WM_SYSCOMMAND, SC_close, 0);
end;
function TForm1.form_hwnd(s1:string):HWnd;
var
h: HWnd;
szText: array[0..254] of char;
s:string;
begin
result:=0;
h := GetWindow(Handle, GW_HWNDFIRST);
while h <> 0 do
begin
if GetWindowText(h, @szText, 255) > 0 then
begin
s:=trim(StrPas(@szText));
if (length(s)>0) and (pos(s1,s)>0) then
begin
result:=h;
exit;
end;
end;
h := GetWindow(h, GW_HWNDNEXT);
result:=h;
end;
end;