我之前在Inno Setup中的安装(A)有AppID = {{8ADA0E54-F327-4717-85A9-9DE3F8A6D100}.
我有另一个具有不同AppID的安装(B),我想将它安装到与安装(A)相同的目录中.
如何自动获取DefaultDirName?我不想使用相同的AppID,因为当我卸载安装(B)并且安装(A)保持安装时,它将从注册表中删除AppID字符串(安装(A)字符串).
你能帮我吗?
你可能需要一些代码才能做你想做的事.您还需要一种方法来查找Application A的安装目录.这是我使用过的一些代码
[Setup]
DefaultDirName={code:GetDefaultDir}
[Code]
function GetDefaultDir(def: string): string;
var
sTemp : string;
begin
//Set a defualt value so that the install doesn't fail.
sTemp := ExpandConstant('{pf}') + '\MyCompany\MyAppA';
//We need to get the current install directory.
if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\MyCompany\Products\MyAppNameA',
'InstallDir', sTemp) then
begin
//We found the value in the registry so we'll use that. Otherwise we use the default
end;
Result := sTemp;
end;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5684 次 |
| 最近记录: |