首页 > 其他 > 详细

Inno Setup安装、卸载时判断是否程序正在运行

时间:2016-09-04 14:29:38      阅读:527      评论:0      收藏:0      [点我收藏+]

var

ErrorCode: Integer;

IsRunning: Integer;

// 安装时判断客户端是否正在运行

function InitializeSetup(): Boolean;

begin

Result :=true; //安装程序继续

IsRunning:=FindWindowByWindowName(‘E家人客户端‘);

while IsRunning<>0 do

begin

if Msgbox(‘安装程序检测到客户端正在运行。‘ #13#13 ‘您必须先关闭它然后单击“是”继续安装,或按“否”退出!‘, mbConfirmation, MB_YESNO) = idNO then

begin

Result :=false; //安装程序退出

IsRunning :=0;

end else begin

Result :=true; //安装程序继续

IsRunning:=FindWindowByWindowName(‘E家人客户端‘);

end;

end;

end;

// 卸载时判断客户端是否正在运行

function InitializeUninstall(): Boolean;

begin

Result :=true; //安装程序继续

IsRunning:=FindWindowByWindowName(‘E家人客户端‘);

while IsRunning<>0 do

begin

if Msgbox(‘安装程序检测到客户端正在运行。‘ #13#13 ‘您必须先关闭它然后单击“是”继续安装,或按“否”退出!‘, mbConfirmation, MB_YESNO) = idNO then

begin

Result :=false; //安装程序退出

IsRunning :=0;

end else begin

Result :=true; //安装程序继续

IsRunning:=FindWindowByWindowName(‘E家人客户端‘);

end;

end;

end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);

begin

case CurUninstallStep of

usUninstall:

begin // 开始卸载

end;

usPostUninstall:

begin // 卸载完成

// MsgBox(‘CurUninstallStepChanged:‘ #13#13 ‘Uninstall just finished.‘, mbInformation, MB_OK);

// ...insert code to perform post-uninstall tasks here...

ShellExec(‘open‘, ‘http://domain‘, ‘‘, ‘‘, SW_SHOWNORMAL, ewNoWait, ErrorCode);

end;

end;

end;

Inno Setup安装、卸载时判断是否程序正在运行

原文:http://www.cnblogs.com/zhangzhifeng/p/5839101.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!