2011-09-13 8 views
5

이후에 명령을 실행하려면 설치 제거가 필요합니다. 설치 한 파일이 제거됩니다. [UninstallRun]은 파일이 제거되기 전에 실행되는 것으로 알고 있으므로 사용하지 않습니다. "postuninstall"플래그가 필요합니다.제거한 후 명령 실행

위의 사항을 어떻게 수행 할 수 있습니까?

답변

9

설명서의 "Uninstall Event Functions"을 참조하십시오. 'CurUninstallStep'이 'usPostUninstall'인 경우 예를 들어 CurUninstallStepChanged을 사용할 수 있습니다.

+0

잡았다 - 많은 감사합니다! – eyoopmeduck

+0

@eyoopmeduck - 문제가 해결 되었다면 답을 수락해야합니다. 답변 옆의 큰 눈금/체크 표시를 사용하십시오. – Vicky

+0

죄송합니다 - 이것은 내 첫 번째 질문입니다. Mark에 감사드립니다. – eyoopmeduck

4

Inno는 [Run] 섹션과 동일한 방법으로 [UninstallRun] 섹션을 정의하여 unistall에서 실행해야하는 설치 프로그램 패키지의 파일을 지정합니다. 예를 들어

:

[UninstallRun] 
Filename: {app}\Scripts\DeleteWindowsService.bat; Flags: runhidden; 

또한, 이벤트 함수의 사용이 튜닝 좀 더 unistalling 활동에 사용할 수 있습니다 @Sertac Akyuz에 의해 제안 된 솔루션을 제공합니다. 다음은 다른 관련 함수 중 CurUninstallStepChanged 함수의 사용 예입니다.

https://github.com/HeliumProject/InnoSetup/blob/master/Examples/UninstallCodeExample1.iss

; -- UninstallCodeExample1.iss -- 
; 
; This script shows various things you can achieve using a [Code] section for Uninstall 

[Setup] 
AppName=My Program 
AppVersion=1.5 
DefaultDirName={pf}\My Program 
DefaultGroupName=My Program 
UninstallDisplayIcon={app}\MyProg.exe 
OutputDir=userdocs:Inno Setup Examples Output 

[Files] 
Source: "MyProg.exe"; DestDir: "{app}" 
Source: "MyProg.chm"; DestDir: "{app}" 
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme 

[Code] 
function InitializeUninstall(): Boolean; 
begin 
    Result := MsgBox('InitializeUninstall:' #13#13 'Uninstall is initializing. Do you really want to start Uninstall?', mbConfirmation, MB_YESNO) = idYes; 
    if Result = False then 
    MsgBox('InitializeUninstall:' #13#13 'Ok, bye bye.', mbInformation, MB_OK); 
end; 

procedure DeinitializeUninstall(); 
begin 
    MsgBox('DeinitializeUninstall:' #13#13 'Bye bye!', mbInformation, MB_OK); 
end; 

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); 
begin 
    case CurUninstallStep of 
    usUninstall: 
     begin 
     MsgBox('CurUninstallStepChanged:' #13#13 'Uninstall is about to start.', mbInformation, MB_OK) 
     // ...insert code to perform pre-uninstall tasks here... 
     end; 
    usPostUninstall: 
     begin 
     MsgBox('CurUninstallStepChanged:' #13#13 'Uninstall just finished.', mbInformation, MB_OK); 
     // ...insert code to perform post-uninstall tasks here... 
     end; 
    end; 
end; 
+1

OP는 설치 주문 때문에'[UninstallRun]'이 적절하지 않다고 명백하게 명시했다. – Deanna

관련 문제