2011-01-28 124 views
2

我曾嘗試使用被張貼的答案後,這裏Problems in deleting a Folder during the uninstalation with Inno Setup無法刪除

描述的程序在我與Inno Setup的文檔創建的文件夾,但不知什麼原因,我認爲部分代碼沒有做任何事情。可能與Windows版本有關,或者它是32位還是64位?

這裏是由我使用的代碼:

procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep); 
var 
mres : integer; 
begin 
case CurUninstallStep of 
usPostUninstall: 
begin 
mres := MsgBox('Do you want to delete saved games?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) 
if mres = IDYES then 
    DelTree('ExpandConstant({userdocs}\SpellForce2)', True, True, True); 
    end; 
    end; 
end; 

任何想法,可能是有用的,我呢?

在此先感謝! :)

回答

1

您正在試圖刪除名爲'ExpandConstant({用戶文檔} \ SpellForce2)'一個文件夾(字面意思),只要將'字符移除到ExpandConstant調用(這是對子例程的調用)。

procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep); 
var 
    mres : integer; 
begin 
    case CurUninstallStep of 
    usPostUninstall: 
     begin 
     mres := MsgBox('Do you want to delete saved games?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) 
     if mres = IDYES then 
      DelTree(ExpandConstant('{userdocs}\SpellForce2'), True, True, True); 
     end; 
    end; 
end; 
+0

這工作得很好。非常感謝。 – Cosmin 2011-01-31 13:18:00

1

你不能這樣做

DelTree('ExpandConstant({userdocs}\SpellForce2)', True, True, True); 

當然,這應該讀

DelTree(ExpandConstant('{userdocs}\SpellForce2'), True, True, True);