我試圖在wpPreparing
頁面上放置一個標籤,指示在運行新安裝之前卸載現有版本。這裏是我的代碼:Inno Setup在wpPreparing上放置控件頁面
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
UninstallingLabel: TNewStaticText;
intResultCode: Integer;
begin
with UninstallingLabel do
begin
Caption := 'Uninstalling existing version...';
Left := WizardForm.StatusLabel.Left;
Top := WizardForm.StatusLabel.Top;
Parent := wpPreparing.Surface;
end;
if strExistingInstallPath <> '' then
begin
Exec(GetUninstallString, '/verysilent /suppressmsgboxes', '', SW_HIDE,
ewWaitUntilTerminated, intResultCode);
end;
end;
麻煩的是它似乎不喜歡Parent := wpPreparing.Surface
和編譯失敗,並
分號(;)預計
錯誤。將標籤添加到自定義創建的頁面時,此語法起作用。爲什麼在嘗試將其添加到wpPreparing
時失敗?
謝謝馬丁。 'WizardForm.PreparingPage'是我所需要的。我意外地忽略了我發佈的代碼中的標籤創建行。因爲「PrepaaringLabel」與「StatusLabel」的對齊方式不同(它進一步向右偏移),所以我沒有重複使用'PreparingLabel'並引用'StatusLabel'座標。也許'PreparingLabel'的位置可以修改以反映'StatusLabel'的位置,但我不知道如何去做,所以就去創建自己的標籤。 –