我的想再卸载的时候,先判断这两个程序有没在运行,如果有运行就自动杀掉再卸载。
我看了论坛以前发的帖子,也成功杀掉了,但是只有一个进程,我现在有2个进程,代码部分我不会修改,现在发上来帮忙看看,如何改?
function InitializeUninstall(): Boolean;
var
IsAppRunning: boolean;
IsAppRunning2: boolean;
ResultCode: Integer;
begin
begin
Result:= true;
IsAppRunning:= IsModuleLoaded('AlarmRelay.exe');
while IsAppRunning
do
begin
if MsgBox('检测到AlarmRelay正在运行,卸载时请关闭!'#13'要自动关闭它并继续吗?', mbConfirmation, MB_OKCANCEL) = IDOK then
begin
Exec(ExpandConstant('{app}\janhkill.exe'), 'AlarmRelay.exe', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
IsAppRunning:= IsModuleLoaded('AlarmRelay.exe');
end
else
begin
IsAppRunning:= false;
Result:= false;
end;
end;
UnloadDLL(ExpandConstant('{app}\psvince.dll'));
end;
begin
Result:= true;
IsAppRunning2:= IsModuleLoaded('syncTime.exe');
while IsAppRunning
do
begin
if MsgBox('检测到syncTime正在运行,卸载时请关闭!'#13'要自动关闭它并继续吗?', mbConfirmation, MB_OKCANCEL) = IDOK then
begin
Exec(ExpandConstant('{app}\janhkill.exe'), 'syncTime.exe', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
IsAppRunning:= IsModuleLoaded('syncTime.exe');
end
else
begin
IsAppRunning:= false;
Result:= false;
end;
end;
UnloadDLL(ExpandConstant('{app}\psvince.dll'));
end
end;
这个是我自己写的代码,但是还是只能检测第一个进程,插件什么的又需要我再上传。