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:
| 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; |