[Lazarus] problem opening html help pages with spaces in path

Andrea Mauri andrea.mauri.75 at gmail.com
Fri Sep 17 18:03:00 CEST 2010


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.
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.





More information about the Lazarus mailing list