잠시 동안이 문제가 발생했습니다. 이 게시물까지, 나는 실제로 온라인 도움말을 요청한 적이 없다.Inno Setup에서 TOutPutProgressWizardPage 설치를 어떻게 종료합니까?
Inno Setup을 사용하여 설치 프로그램을 작성했습니다. 그것은 많은 것들을 설치하는데, 그 중 하나는 Java Development Kit의 최신 릴리스입니다. 내 문제는 JDK 설치가 존재하는지 여부를 확인해야합니다. 그렇지 않으면 설치를 종료하십시오. TOutPutProgressWiazrdPage를 사용하여이 프로세스를 사용자에게 설명하는 것이 아니라면이 작업은 충분히 쉬운 것처럼 보입니다. "중단"또는 "종료"때까지 모든 것이 정상입니다. 이 중 하나를 치고 나면 설치가 엉망이됩니다. 제발, 어떤 도움을 주시면 감사하겠습니다. 내 샘플 코드는 다음과 같습니다.
//JDK Install
procedure InstallJDK();
var
ErrorCode, x: Integer;
Return,Path: String;
Paths: TArrayOfString;
begin
if (IsComponentSelectedLog('Prerequisites\JDK')) then
begin
GetJavaVersion();
Path := GetEnv('path'); //(TNG-1463)
if (CompareVersion(Installed_Java_Version, JDK_MIN_VERSION) = VERSION_LESS_THAN) and (Installed_Java_Version <> '') then
begin
if (Pos(Lowercase(JDK_ORACLE_DIR + '\jdk1.6.0_18'), Lowercase(Path)) <> 0) or (Pos(Lowercase(JDK_SUN_DIR + '\jdk1.6.0_18'), Lowercase(Path)) <> 0) or (Pos(Lowercase(JDK_ORACLE_DIR + '\jdk1.6.0_22'), Lowercase(Path)) <> 0)then
begin
SetFormText('Removing JDK Version: ' + Installed_Java_Version + '...', 'Preparing System...', JavaInstallationPage);
//Remove Java Update 1.6.0_18
ShellExecLog('open', ExpandConstant('cmd'),ExpandConstant('/C "start /w MsiExec /qn /X {{26A24AE4-039D-4CA4-87B4-2F83216018FF} /L ' + TNG_Install_Log_Dir + '\ju_' + Installed_Java_Version + '_uninstall.log"'), ExpandConstant('{sys}'), SW_HIDE, ewWaitUntilTerminated, ErrorCode);
UpdateProgressBar(PBarJavaInstall, 76);
//Remove JDK 1.6.0_18
ShellExecLog('open', ExpandConstant('cmd'),ExpandConstant('/C "start /w MsiExec /qn /X {{32A3A4F4-B792-11D6-A78A-00B0D0160180} /L ' + TNG_Install_Log_Dir + '\jdk_' + Installed_Java_Version + '_uninstall.log"'), ExpandConstant('{sys}'), SW_HIDE, ewWaitUntilTerminated, ErrorCode);
UpdateProgressBar(PBarJavaInstall, 80);
//Remove Java Update 1.6.0_22
ShellExecLog('open', ExpandConstant('cmd'),ExpandConstant('/C "start /w MsiExec /qn /X {{26A24AE4-039D-4CA4-87B4-2F83216022FF} /L ' + TNG_Install_Log_Dir + '\ju_' + Installed_Java_Version + '_uninstall.log"'), ExpandConstant('{sys}'), SW_HIDE, ewWaitUntilTerminated, ErrorCode);
UpdateProgressBar(PBarJavaInstall, 76);
//Remove JDK 1.6.0_22
ShellExecLog('open', ExpandConstant('cmd'),ExpandConstant('/C "start /w MsiExec /qn /X {{32A3A4F4-B792-11D6-A78A-00B0D0160220} /L ' + TNG_Install_Log_Dir + '\jdk_' + Installed_Java_Version + '_uninstall.log"'), ExpandConstant('{sys}'), SW_HIDE, ewWaitUntilTerminated, ErrorCode);
UpdateProgressBar(PBarJavaInstall, 80);
//Remove JDK 1.6.0_18 Directories
if DirExists(JDK_SUN_DIR + '\jdk1.6.0_18') then
begin
DelTree(JDK_SUN_DIR + '\jdk1.6.0_18', True, True, True);
end;
if DirExists(JDK_ORACLE_DIR + '\jdk1.6.0_18') then
begin
DelTree(JDK_ORACLE_DIR + '\jdk1.6.0_18', True, True, True);
end;
//Remove JDK 1.6.0_22 Directories
if DirExists(JDK_ORACLE_DIR + '\jdk1.6.0_22') then
begin
DelTree(JDK_ORACLE_DIR + '\jdk1.6.0_22', True, True, True);
end;
//Clean Up Path
if (Pos(Lowercase(JDK_ORACLE_DIR), Lowercase(Path)) <> 0) or (Pos(Lowercase(JDK_SUN_DIR), Lowercase(Path)) <> 0) then
begin
Paths := Split(Path,';',0);
Path := '';
for x := 0 to GetArrayLength(Paths)-1 do
begin
if (Pos(Lowercase(JDK_ORACLE_DIR), Lowercase(Paths[x])) <> 0) or (Pos(Lowercase(JDK_SUN_DIR), Lowercase(Paths[x])) <> 0) then
begin
Paths[x] := '';
end;
end;
for x := 0 to GetArrayLength(Paths)-1 do
begin
if Paths[x] <> '' then
begin
if path = '' then
begin
Path := Paths[x];
end
else
Path := Path + ';' + Paths[x];
end;
end;
end;
SetxEnv('path', ExpandConstant(Path));
UpdateProgressBar(PBarPostInstall1, 100);
end;
GetJavaVersion();
end;
if (CompareVersion(Installed_Java_Version, JDK_MIN_VERSION) = VERSION_LESS_THAN) then
begin
//Install JDK
Log('In Progress......Executing jdk-6u23-windows-i586.exe');
UpdateProgressBar(PBarJavaInstall, 10);
if (CheckSupportExist('jdk-6u23-windows-i586.exe')) then
begin
Create_Dir(ExpandConstant('{sd}\apps'), JavaInstallationPage);
Create_Dir(JDK_ORACLE_DIR, JavaInstallationPage);
Create_Dir(ExpandConstant('{sd}\TNG2.0'), JavaInstallationPage);
Create_Dir(ExpandConstant('{sd}\TNG2.0\install'), JavaInstallationPage);
SetFormText('Installing JDK Version: ' + JDK_MIN_VERSION + '...', 'Preparing System...', JavaInstallationPage);
ShellExecLog('open', 'jdk-6u23-windows-i586.exe', '/s /v /qn" ADDLOCAL=ALL REBOOT=SUPPRESS INSTALLDIR=' + JDK_Dir + ' /L ' + TNG_Install_Log_Dir + '\jdk_' + JDK_MIN_VERSION + '_install.log"', ExpandConstant('{src}\Support\'), SW_HIDE, ewNoWait, ErrorCode);
UpdateProgressBarUntilProgressHasEnded('jdk-6u23-windows-i586.exe', 100, 2, JavaInstallationPage, PBarJavaInstall);
GetJavaVersion();
if (not (CompareVersion(Installed_Java_Version, JDK_MIN_VERSION) = VERSION_EQUAL)) then
begin
Log('Failed......' + JDK + ' ' + JDK_MIN_VERSION + ' Installation : Versions do not match.');
LogError('Failed......' + JDK + ' ' + JDK_MIN_VERSION + ' Installation');
ExitSetup := True;
end
else if (CompareVersion(Installed_Java_Version, JDK_MIN_VERSION) = VERSION_EQUAL) then
begin
Log('Success......' + JDK + ' ' + Installed_Java_Version + ' Installed');
if GetEnv('JAVA_HOME') <> JDK_Dir then
begin
ErrorCode := SetxEnv('JAVA_HOME', ExpandConstant(JDK_Dir));
end;
//(TNG-1463) Prepend the %Java_Home%\bin so that it is the first JDK in the system's path
SetxEnv('path', ExpandConstant(JDK_Bin_DIR + ';' + Path));
end;
end
else
begin
MsgBox('Please re-run the install after the jdk-6u23-windows-i586.exe support install is placed in the support folder.', mbInformation, MB_OK);
Log('User chose not to install the ' + JDK + ' ' + JDK_MIN_VERSION);
ExitSetup := True;
end;
end
else if (CompareVersion(Installed_Java_Version, JDK_MIN_VERSION) = VERSION_EQUAL) then
begin
Log('Already Installed......' + JDK + ' ' + JDK_MIN_VERSION);
end
else
begin
LogError('Failed......' + JDK + ' Installation');
ExitSetup := True;
end;
end;
end;
//Activate Setup Page
//
procedure JavaInstallationPage_Activate(Page: TWizardPage);
var
ErrorCode: Integer;
begin
//Install JDK
InstallJDK()
if (ExitSetup = True) then
begin
try
finally
JavaInstallationPage.Hide;
end;
**Abort**;
end;
end;
procedure InitializeWizard();
begin
// Installation Page
JavaInstallationPage := CreateOutputProgressPage('JDK Installation', 'Setup is preparing the system.....');
//JavaInstallationPage := CreateCustomPage(wpSQL_No_SQL_SelectSqlServer, 'POS Manufacturer Settings', 'Please select a supported manufacturer or select default');
lblJavaInstallDescription1 := TLabel.Create(JavaInstallationPage);
with lblJavaInstallDescription1 do
begin
Top := 1;
Caption := '';
AutoSize := True;
Parent := JavaInstallationPage.Surface;
end;
lblJavaInstallDescription2 := TLabel.Create(PreInstallationPage);
with lblJavaInstallDescription2 do
begin
Top := lblJavaInstallDescription1.Top + lblJavaInstallDescription1.Height + 5;
Caption := 'Installing Java Development Kit...';
AutoSize := True;
Parent := JavaInstallationPage.Surface;
end;
PBarJavaInstall := TNewProgressBar.Create(JavaInstallationPage);
with PBarJavaInstall do
begin
Parent := JavaInstallationPage.Surface;
Width := JavaInstallationPage.SurfaceWidth;
Top := lblJavaInstallDescription2.Top + lblJavaInstallDescription2.Height + 3;
Height := 19;
Max := 105;
end;
JavaInstallationPage.OnActivate := @JavaInstallationPage_Activate;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
ErrorCode: Integer;
DisplayJavaInstallPage: boolean;
FileName: string;
FileLines: TArrayOfString;
begin
if CurPageID = wpTomCatPortSettings then
begin
DisplayJavaInstallPage := True;
end;
if DisplayJavaInstallPage then
begin
GetJavaVersion();
if (CompareVersion(Installed_Java_Version, JDK_MIN_VERSION) <> VERSION_EQUAL) then
begin
JavaInstallationPage.Show;
try
finally
JavaInstallationPage.Hide;
end;
if (CompareVersion(Installed_Java_Version, JDK_MIN_VERSION) <> VERSION_EQUAL) then
begin
**Abort**;
end;
end;
end;
if (not LocalesPopulated) and (CompareVersion(Installed_Java_Version, JDK_MIN_VERSION) = VERSION_EQUAL) and (PageCount >= 4) and isComponentSelected('XPressPOS\MWB\Locale') then
begin
// Configure MWB_Localization Settings Page
FileName := ExpandConstant('{tmp}\GetAllAvailableLocalesbyLocale.class');
ExtractTemporaryFile(ExtractFileName(FileName));
FileName := ExpandConstant('{tmp}\GetLocaleDisplayName.class');
ExtractTemporaryFile(ExtractFileName(FileName));
FileName := ExpandConstant('{tmp}\GetLocaleByDescription.class');
ExtractTemporaryFile(ExtractFileName(FileName));
if SelectedLangauge <> 'es' then
begin
#if Debug == "True"
ShellExecLog('open', 'cmd', ExpandConstant('/K "{sd}&&cd {tmp}\&&java GetAllAvailableLocalesbyLocale en US > .\Localizations.txt"'), '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
#else
ShellExecLog('open', 'cmd', ExpandConstant('/C "{sd}&&cd {tmp}\&&java GetAllAvailableLocalesbyLocale en US > .\Localizations.txt"'), '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
#endif
end
else
begin
#if Debug == "True"
ShellExecLog('open', 'cmd', ExpandConstant('/K "{sd}&&cd {tmp}\&&java GetAllAvailableLocalesbyLocale en MX > .\Localizations.txt"'), '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
#else
ShellExecLog('open', 'cmd', ExpandConstant('/C "{sd}&&cd {tmp}\&&java GetAllAvailableLocalesbyLocale es MX > .\Localizations.txt"'), '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
#endif
end;
lstLocalizations.Items.clear;
chkDisplayUnsupported.Checked := False;
if LoadStringsFromFile(ExpandConstant('{tmp}\Localizations.txt'), FileLines) then
begin
for I := 0 to GetArrayLength(FileLines)-1 do
begin
if ((FileLines[I] = 'English (United States)') or (FileLines[I] = 'Spanish (Mexico)')) then
begin
lstLocalizations.Items.Add(FileLines[I]);
end;
end;
end;
LocalesPopulated := True;
end;
Result := True;
end;
function BackButtonClick(CurPageID: Integer): Boolean;
begin
PageCount := PageCount - 1;
Result := True;
end;
"건초 더미"란 무엇을 의미합니까? 그 행동은 무엇입니까? 설치 로그에 무엇이 있습니까? – mirtheil
InializeSetup 루틴에서 중단이 필요할 수있는 검사를 배치하여이 문제를 해결했습니다. 중단은 거기에서 잘 작동합니다. 다른 곳에서 시도하고 중단하면 스크립트가 올바르게 종료되지 않고 예기치 않은 예외가 발생합니다. 특히 내부에서 중단을 호출하면 마무리가됩니다. – TheAnomaly