Открыть URL в новом стандартном окне TWebBrowser
Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch
uses
ShellAPI, Registry;
procedure OpenURL(Url: string);
var
ts: string;
begin
with TRegistry.Create do
try
rootkey := HKEY_CLASSES_ROOT;
OpenKey('\htmlfile\shell\open\command', False);
try
ts := ReadString('');
except
ts := '';
end;
CloseKey;
finally
Free;
end;
if ts = '' then Exit;
// remove quotes and commandline parameters
ts := Copy(ts, Pos('"', ts) + 1, Length(ts));
ts := Copy(ts, 1, Pos('"', ts) - 1);
ShellExecute(0, 'open', PChar(ts), PChar(url), nil, SW_SHOW);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenURL('http://www.SwissDelphiCenter.ch');
end;
|