View Single Post
  #3  
Old 12-06-2016, 11:28
vint56 vint56 is offline
Registered User
 
Join Date: May 2011
Location: almaty
Posts: 52
Thanks: 145
Thanked 55 Times in 31 Posts
vint56 is on a distinguished road
Code:
1
[Setup]
DefaultDirName={code:MyDirName}

[ Code]
function MyDirName(S:String): String;
var
  InsPath: String;
  er: boolean;
  myFile:String;
begin
  Result:=ExpandConstant('C:\Games\World_of_Tanks\'); //если ключа нет то будем ставить сюда
  er := RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{1EAC1D02-C6AC-4FA6-9A44-96258C37C812RU}_is1', 'InstallLocation', InsPath);
  er := RegQueryStringValue(HKCU, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{1EAC1D02-C6AC-4FA6-9A44-96258C37C812ru}_is1', 'InstallLocation', InsPath);
  if er and (InsPath<>'') then //если ключ существует и там что-то записано
  begin
    Result := InsPath;
  end;
end;
2
Code:
[Setup]
AppName=My Program
AppVerName=My Program 1.5
DefaultDirName={code:GetInstallDir}
AppendDefaultDirName=no

[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"

[ Code]
function GetInstallDir(Path: String ): String;
begin
RegQueryStringValue(HKLM, 'SOFTWARE\Rockstar Games\EFLC', 'InstallPath', Path);//Какой ключ реестра ищет ...
Result := Path;
end;

function InitializeSetup(): Boolean;
begin
Result:= true;
if not RegKeyExists(HKLM, 'SOFTWARE\Rockstar Games\EFLC') then
MsgBox('Игра {#SetupSetting("AppName")} не найдена! Укажите путь к папке с игрой вручную!', mbinformation, mb_ok);
end;
3
Code:
[Setup] 
AppName=S.T.A.L.K.E.R OGS Evolution 0.6.9.3 Patch 
AppVersion=2.12 
VersionInfoVersion=0.2.1.2 
DefaultDirName={reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\S.T.A.L.K.E.R OGSE Mod_is1,InstallLocation|{pf}}
AppendDefaultDirName=no
Reply With Quote