1
我想在我的AfterInstall函數失敗時在IS中執行回滾。這是我的代碼示例。撤銷或回滾安裝
[Files]
Source: "MyWinService.exe"; DestDir: "{app}"; Flags: ignoreversion; AfterInstall: MyAfterInstall
Source: "MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion
[Code]
const
WM_CLOSE = $0010;
procedure MyAfterInstall();
var
exitCode: Integer;
begin
MsgBox (ExpandConstant('{cm:ErrServiceInstall}'), mbError, MB_OK);
SendMessage(WizardForm.Handle, WM_CLOSE, 0, 0);
end;
在這個示例中,我只是直接想要取消安裝,以便測試安裝回滾。這裏發生的是MsgBox顯示後,由於SendMessage的緣故,顯示ExitSetupMsgBox。當我在ExitSetupMsgBox中單擊是時,將執行回滾。我想要的是ExitSetupMsgBox不顯示,因爲我已經顯示了MsgBox。所以當我單擊確定MsgBox回滾將被執行。
可以這樣做嗎?
這很好..但我怎麼能不通過點擊取消按鈕對話框來調用這個事件呢? – patlimosnero 2011-06-08 08:03:49
@patlimosnero - 更新答案,詳細說明如何避免發送消息。 – 2011-06-08 09:44:48