[Lazarus] FindDefaultBrowser & opening URL

Bart bartjunk64 at gmail.com
Wed Oct 12 17:39:30 CEST 2011


Don't we have a OpenURL() function just for for that (in LCLIntf unit)?

Bart

On 10/12/11, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
> On Wed, 12 Oct 2011 13:55:08 +0200
> Reinier Olislagers <reinierolislagers at gmail.com> wrote:
>
>> 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
>   FindDefaultBrowser(Browser, Params);
>
> The params are currently done for the old version of TProcess. The URL
> is quoted.
>
>   with TProcess.Create(nil) do
>   try
>     Executable := Browser;
>     Params:=Format(Params, [URL]);
>     Params:=copy(Params,2,length(Params)-2);
>     Parameters.Add(Params);
>     Options := [poNoConsole];
>     Execute;
>   finally
>     Free;
>   end;
> end;
>
>
> Mattias
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>




More information about the Lazarus mailing list