[Lazarus] FindDefaultBrowser & opening URL

Reinier Olislagers reinierolislagers at gmail.com
Wed Oct 12 13:55:08 CEST 2011


Hi list,

I'm trying to open an URL in the user's browser. I've edited the example
from the wiki
http://wiki.lazarus.freepascal.org/Executing_External_Programs#Open_web_page_in_default_web_browser
until it compiles but I suspect I'm sending the wrong Params.

A quick look through the LCLIntf code wasn't enlightening either.

How should I write this procedure?

Thanks
Reinier

uses Process, LCLIntf
...
procedure OpenWebPage(URL: string);
var
  Browser, Params: string;
begin
  Params:='http';  //What should I do here?
  FindDefaultBrowser(Browser, Params);
  with TProcess.Create(nil) do
  try
    Executable := Browser;
    Parameters.Add(Format(Params, [URL]));
    Options := [poNoConsole];
    Execute;
  finally
    Free;
  end;
end;




More information about the Lazarus mailing list