[Code]
//卸载软件,红色部分需要修改,参考APPID
function InitializeSetup(): boolean;
var
ResultStr: String;
ResultCode: Integer;
begin
if RegQueryStringValue(HKLM, ‘SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{7AB469CE-8A39-4AC5-9656-37AE61E6B1A2}_is1’, ‘UninstallString’, ResultStr) then
begin
ResultStr := RemoveQuotes(ResultStr);
Exec(ResultStr, ‘/silent’, ‘’, SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
result := true;
end;
//删除 卸载后的残余文件
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usDone then
begin
DelTree(ExpandConstant(’{app}’), True, True, True);
end;
end;
本文提供了一段用于自动卸载指定软件的代码,并清理了卸载后可能残留的文件夹。该代码通过注册表读取卸载字符串并执行静默卸载,最后删除指定的应用文件夹。

被折叠的 条评论
为什么被折叠?



