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


    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;

  • 相关阅读:
    【转】嵌入式程序员应该知道的16个问题
    GetMemory()函数
    Some good questions
    [转]永远做一个有计划的人
    内存分配管理
    c语言面试题(感觉比较好的题目)
    const char*, char const*, char*const的区别
    《论语》《中庸》《大学》经典语录
    洗脑
    python基础之函数参数,名称空间,以及函数嵌套
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/5839101.html
Copyright © 2020-2023  润新知