|
- function InitializeSetup():boolean;
- var
- ResultCode: Integer;
- IsRunning: Integer;
- begin
- Result :=true; //安装程序继续
- Exec(ExpandConstant('{cmd}'), 'for /f %%i ' +
- 'in (''reg query "HKCU\Software\KL\Running Applications"^|findstr /i /r /c:"^ *KL V26\.5 [0-9][0-9]*"^|find /c /v ""'') ' +
- 'do set IsRunning=%%i'
- ,ExpandConstant('{app}'), SW_SHOWNORMAL, ewNoWait, ResultCode);
- while IsRunning<>0 do
- begin
- if Msgbox('安装程序检测到KL8.5正在运行。' #13#13 '您必须先关闭它然后单击“是”继续安装,或则按“否”退出!', mbConfirmation, MB_YESNO) = idNO then
- begin
- Result :=false; //安装程序退出
- IsRunning :=0;
- end else
- begin
- Exec(ExpandConstant('{cmd}'), 'for /f %%i ' +
- 'in (''reg query "HKCU\Software\KL\Running Applications"^|findstr /i /r /c:"^ *KL V26\.5 [0-9][0-9]*"^|find /c /v ""'') ' +
- 'do set IsRunning=%%i'
- ,ExpandConstant('{app}'), SW_SHOWNORMAL, ewNoWait, ResultCode);
- end;
- end;
- end;
- end;
- function InitializeUninstall(): Boolean;
- var
- IsRunning: Integer;
- begin
- Result :=true; //卸载程序继续
- Exec(ExpandConstant('{cmd}'), 'for /f %%i ' +
- 'in (''reg query "HKCU\Software\KL\Running Applications"^|findstr /i /r /c:"^ *KL V26\.5 [0-9][0-9]*"^|find /c /v ""'') ' +
- 'do set IsRunning=%%i'
- ,ExpandConstant('{app}'), SW_SHOWNORMAL, ewNoWait, ResultCode);
- while IsRunning<>0 do
- begin
- if Msgbox('安装程序检测到KL8.5正在运行。' #13#13 '您必须先关闭它然后单击“是”继续卸载,或则按“否”退出!', mbConfirmation, MB_YESNO) = idNO then
- begin
- Result :=false; //卸载程序退出
- IsRunning :=0;
- end else
- begin
-
- Exec(ExpandConstant('{cmd}'), 'for /f %%i ' +
- 'in (''reg query "HKCU\Software\KL\Running Applications"^|findstr /i /r /c:"^ *KL V26\.5 [0-9][0-9]*"^|find /c /v ""'') ' +
- 'do set IsRunning=%%i'
- ,ExpandConstant('{app}'), SW_SHOWNORMAL, ewNoWait, ResultCode);
- end;
- end;
- end;
我瞎搞了一阵,但是运行上面代码,出现报警
|