INNO setup安裝卸載錢判斷進程中是否在運行總結

1.安裝前判斷進程中是否有程序在運行。app

[files]code

; 安裝前判斷進程,dll文件放在inno的安裝目錄中
Source: compiler:psvince.dll; Flags: dontcopy noencryption進程

[Code]
//安裝前判斷是否有進程正在運行
function IsModuleLoaded(modulename: String ): Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall setuponly';
function InitializeSetup(): boolean;
var
IsAppRunning: boolean;
begin
Result:= true;
IsAppRunning:= IsModuleLoaded('WordTutor.exe');
while IsAppRunning do
begin
if MsgBox('快樂背單詞正在運行,請先關閉它!', mbConfirmation, MB_OKCANCEL) = IDOK then
IsAppRunning:= IsModuleLoaded('WordTutor.exe')
else
begin
IsAppRunning:= false;
Result:= false;
end;
end;
end;get

 

2.卸載前判斷進程中是否在運行。it

// 卸載前判斷進程是否在運行.與安裝相同的dll文件和須要打包的安裝文件放在一塊兒,也就是和.exe文件一塊兒io

[code]function

function IsModuleLoadedU(modulename: String ): Boolean;
external 'IsModuleLoaded@{app}\psvince.dll stdcall uninstallonly';
function InitializeUninstall(): boolean;
var
IsAppRunning: boolean;
begin
Result:= true;
IsAppRunning:= IsModuleLoadedU('WordTutor.exe');
while IsAppRunning do
begin
if MsgBox('快樂背單詞正在運行,請先關閉它!', mbConfirmation, MB_OKCANCEL) = IDOK then
IsAppRunning:= IsModuleLoadedU('WordTutor.exe')
else
begin
IsAppRunning:= false;
Result:= false;
end;
end;
end;module

相關文章
相關標籤/搜索