Use the below function in innosetup to locate in register the SketchUp In my machine i have installed the SketchUp 2024 In registry have default key in Computer\HKEY_LOCAL_MACHINE\SOFTWARE\SketchUp\SketchUp 2024\InstallLocation
but the SketchUpPath returns nothing what i am doing wrong?
function IsSketchUpInstalled: Boolean;
var
SketchUpPath: string;
Year: Integer;
begin
Result := False;
for Year := 2010 to 2030 do
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\SketchUp\SketchUp '+IntToStr(Year)+'\InstallLocation', '', SketchUpPath) then
begin
Result := True;
Break;
end;
end;
end;
Ok i found the solution
I use the HKLM64 instead of HKLM so the function turns into this and works just fine.
function IsSketchUpInstalled: Boolean;
var
SketchUpPath: string;
Year: Integer;
begin
Result := False;
for Year := 2010 to 2030 do
begin
if RegQueryStringValue(HKLM64, 'SOFTWARE\SketchUp\SketchUp '+IntToStr(Year)+'\InstallLocation', '', SketchUpPath) then
begin
Result := True;
Break;
end;
end;
end;