[Lazarus] problem opening html help pages with spaces in path
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri Sep 17 18:11:35 CEST 2010
On Fri, 17 Sep 2010 18:03:00 +0200
Andrea Mauri <andrea.mauri.75 at gmail.com> wrote:
> Il 17/09/2010 17.23, Mattias Gaertner ha scritto:
> > I fixed FindDefaultBrowser to add "" around the parameter.
> > Please test with svn revision 27397.
>
> Tested. It does not work. I am actually using it both on win and linux.
> I tested it only on win and I got the same problem as before.
Sorry, I thought this was on Linux. I only changed the Linux/Mac part.
For the windows devels: Should the below be added as fallback method
when no browser was found in PATH?
> Actually on Win I do not use FindDefaultBrowser because it does not work
> on my machine because it uses
>
> Find('rundll32', ABrowser);
>
> function Find(const ShortFilename: String; out ABrowser: String):
> Boolean; inline;
> begin
> ABrowser := SearchFileInPath(ShortFilename + GetExeExt, '',
> GetEnvironmentVariableUTF8('PATH'), PathSeparator,
> [sffDontSearchInBasePath]);
> Result := ABrowser <> '';
> end;
>
> That looks for rundll32 on PATH but in my PATH there is not System32
> directory where rundll32 is located.
>
> So in order to find the default browser on Win I use this function:
>
> function GetDefaultBrowser: string;
> var
> Brow: string;
> {$IFDEF MSWINDOWS}
> Reg: TRegistry;
> {$ENDIF}
> begin
> Brow:= '';
> {$IFDEF MSWINDOWS}
> Reg:= TRegistry.Create;
> with Reg do
> begin
> RootKey:= HKEY_CURRENT_USER;
> if OpenKeyReadOnly('SOFTWARE\Clients\StartMenuInternet') then
> begin
> Brow:=ReadString('');
> CloseKey;
> RootKey:=HKEY_LOCAL_MACHINE;
> Brow:=
> Format('SOFTWARE\Clients\StartMenuInternet\%s\shell\open\command', [brow]);
> if OpenKeyReadOnly(brow) then
> begin
> Brow:=ReadString('');
> CloseKey;
> end;
> end;
> end;
> Reg.Free;
> Brow:= StringReplace(brow, '"', '', [rfReplaceAll]);
> {$ENDIF}
> Result:= Brow;
> end;
>
> If it does not work the user can change manually the browserpath property.
Mattias
More information about the Lazarus
mailing list