file - Inno 设置 Windows 注册表无法捕获
问题描述
:-)
我已经在 Inno 设置中进行了一些编程,但现在我认为我无法只见树木不见森林。:-) 我想将“Copyfiles”部分中的一些自定义文件复制到位于注册表中的文件的安装路径中。为此,我调用“GetInstalledPath”并希望获取注册表信息。但是在 Copyfiles 部分中的消息框与输入消息“测试”之后是空的,并且文件也没有复制到正确的位置。我可以发誓它在早期版本中有效,可能是我改变了某事,或者有什么需要注意的?
非常感谢您的观看!
最良好的祝愿并保持健康!JH
function GetInstallPath(Param: String): String;
begin
if Param = 'File1' then
Result := 'C:\Program Files\FolderFile1'
else if Param = 'InstPath32' then
begin
if RegGetSubkeyNames(HKLM32, 'Software\Programname', RegKeys) then
begin
if RegQueryStringValue(HKLM32,'Software\Programname' + '\'+ 'Versionnumber'+ 'Paths','InstallDirectory', Program_PATH2) then
Result := Program_PATH2
else
end
end
else if Param = 'InstPath64' then
begin
if RegGetSubkeyNames(HKLM64, 'Software\Programname', RegKeys) then
begin
if RegQueryStringValue(HKLM64,'Software\Programname' + '\'+ 'Versionnumber+ 'Paths','InstallDirectory', Program_PATH3) then
Result := Program_PATH3
else
MsgBox('InstPath64 ' + Program_PATH3, mbInformation, MB_OK);
end
end
end;
procedure WaitUntilInstalled();
var
I: integer;
count: integer;
begin
count := 0;
I := 0
while (NOT FileExists(ExpandConstant('{tmp}\filename.txt'))) AND (count<90) DO
begin
count := count + 1;
Sleep(1000);
end;
end;
procedure CopyFiles(Param: String) ;
var
SrcDir: String;
DestDir: String;
ResultCode: Integer;
Command: String;
begin
if Param = 'Example32' then
begin
SrcDir := '{tmp}\Customization';
DestDir := GetInstallPath('InstPath32');
Exec('md',ExpandConstant(DestDir),'',SW_SHOW, ewWaitUntilTerminated, ResultCode);
Command := '"' + ExpandConstant(SrcDir) + '" "' + ExpandConstant(DestDir) + '"' + ' /y /E /I';
Exec('xcopy', Command, '',SW_SHOW, ewWaitUntilTerminated, ResultCode);
end
else if Param = 'Example64' then
begin
SrcDir := '{tmp}\Customization';
DestDir := GetInstallPath('InstPath64');
MsgBox('Test' + DestDir, mbInformation, MB_OK)
Exec('md',ExpandConstant(DestDir),'',SW_SHOW, ewWaitUntilTerminated, ResultCode);
Command := '"' + ExpandConstant(SrcDir) + '" "' + ExpandConstant(DestDir) + '"' + ' /y /E /I';
Exec('xcopy', Command, '',SW_SHOW, ewWaitUntilTerminated, ResultCode);
end
end;
解决方案
推荐阅读
- css - 如何使用块显示将thead 和 tbody 宽度保持在 100%
- javascript - 表单提交页面刷新后显示隐藏的 div
- c# - EF core 2.1 使用投影
- c# - 如何将数据从数据表复制到数据库表?
- reactjs - 我如何在反应中运行现有项目
- javascript - 过滤 JSON 数据 ( D3.js )
- android - 领域 - 插入没有重复的条目
- java - 对类的对象进行排序
- javascript - How to close the dropdown if the user clicks outside of it?
- javascript - 当 NVDA 开启时,区分按键并在 Mozilla 中单击