Microsoft Office 용 설치 프로그램, 특히 2007 - 2013 버전을 만듭니다. 두 개의 Office 디렉토리에있는 일부 파일을 복사하기 만하면됩니다. 내 Windows는 64 비트이지만 x64 및 x86 아키텍처 용 설치 프로그램을 만들고 싶습니다.Office의 설치 디렉토리를 Inno Setup 설치 프로그램의 레지스트리에서 가져 오는 방법
그래서 Windows 레지스트리에서 Office 설치 경로를 가져 오는 다음 코드를 작성했습니다. 그리고 각 버전의 Office (2007 - 2013)에서는 설치 경로가 필요하고 나머지 경로가 추가됩니다. 그게 내가 원하는 결과 야.
[Files]
Source: "E:\Google Drive\Informática\Bibword\Bibword Estilos\*"; DestDir: "{code:officeInstallDir|style}"; Flags: ignoreversion
Source: "E:\Google Drive\Informática\Bibword\Bibword file\BIBFORM.xml"; DestDir: "{code:officeInstallDir|bibform}"; Flags: ignoreversion
하지만 매개 변수 스타일이나 bibform을 전달하면 함수 officeInstallDir : 경로 중 하나와
[Code]
function GetHKLM() : Integer;
begin
if IsWin64 then
begin
Result := HKLM64;
end
else
begin
Result := HKEY_LOCAL_MACHINE;
end;
end;
function officeInstallDir(Param: string): string;
// This function takes the type of desired directory,
// verify the version of Office and returns the correct
// directory for style or bibform.
var
styleFolder, bibformFolder : string;
begin
// It verifies the Office version through the registry's subkey and it sets the correct Office's path.
if RegKeyExists(GetHKLM(), '\SOFTWARE\Microsoft\Office\15.0') then begin
styleFolder := '{userappdata}\Roaming\Microsoft\Bibliography\Style';
RegQueryStringValue(GetHKLM(), '\SOFTWARE\Microsoft\Office\15.0\Common', 'InstallRoot', bibformFolder);
bibformFolder := bibformFolder + '\1046\Bibliography';
end else begin
if RegKeyExists(GetHKLM(), '\SOFTWARE\Microsoft\Office\14.0') then begin
RegQueryStringValue(GetHKLM(), '\SOFTWARE\Microsoft\Office\14.0\Common', 'InstallRoot', styleFolder);
styleFolder := styleFolder + 'Bibliography\Style';
bibformFolder := styleFolder + '1046\Bibliography';
end else begin
if RegKeyExists(GetHKLM(), '\SOFTWARE\Microsoft\Office\12.0') then begin
RegQueryStringValue(GetHKLM(), '\SOFTWARE\Microsoft\Office\12.0\Common', 'InstallRoot', styleFolder);
styleFolder := styleFolder + 'Bibliography\Style';
bibformFolder := styleFolder + '1046\Bibliography';
end
end;
end;
// Set the result according Param passed (the first or second type of path).
if Param = 'style' then begin
result := styleFolder;
end else begin
result := bibformFolder;
end;
end;
는이 같은 이노 설정에서 파일의 설치 경로 (DESTDIR)를 설정하려 각 줄에 올바른 경로를 설정하는 데 도움이됩니다. 그러나 RegKeyExists 또는 RegQueryStringValue 레지스트리의 하위 키를 찾을 수 없습니다. 나는 64 비트 노드 문제 때문에 아무 것도하지 않기 때문에 GetHKLM() 함수를 사용해 보았다.
아무도 도와 줄 수 있습니까?
답변 주셔서 감사합니다. 그러나 GetHKLM()에 대한 제안을 시도하고 RegKeyExists() 함수에서 오류가 발생했습니다. 도움말은이 함수를 함수 RegKeyExists (const RootKey : Integer; const SubKeyName : String) : Boolean;으로 정의합니다. 따라서 루트 키는 정수 여야합니다. –
RegKeyExists (GetHKLM(), 'SOFTWARE \ Microsoft \ Office \ 15.0 \ Common \ InstallRoot')를 사용하면 언제 레지스트리 편집을 처음 사용하는 지 이해할 수 없습니다. 왜 if는 'SOFTWARE \ Microsoft \ Office \ 15.0'에서 작동하지 않았습니까? 그리고 다시 한 번 감사드립니다! –
그리고 한 가지 더. 'styleFolder : = '{userappdata} \ Roaming \ Microsoft \ Bibliography \ Style';'styleFolder : = ExpandConstant ('{userappdata} \ Microsoft \ Bibliography \ Style');'에 대한 줄을 변경해야합니다. –