1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
procedure TForm1.Button1Click(Sender: TObject);
const
csOLEObjName = 'InternetExplorer.Application';
var
IE : Variant;
WinHanlde : HWnd;
sURL : string;
begin
if( VarIsEmpty( IE ) )then
begin
sURL:= edit1.Text;
IE := CreateOleObject( csOLEObjName );
IE.Visible := true;
IE.Navigate( sURL );
end else
begin
WinHanlde := FindWIndow( 'IEFrame', nil );
if( 0 <> WinHanlde )then
begin
IE.Navigate( sURL );
SetForegroundWindow( WinHanlde );
end else
begin
// handle error ...
end;
end;
end;
end. |
Partager