[Code]
function Initializeuninstall(): Boolean;varMainrun:hwnd;varMvrun:hwnd;begin
The findwindowbywindowname function parameter is the window name, which is the window caption, not the process name. Mainrun:= Findwindowbywindowname (' main Window'); Mvrun:= Findwindowbywindowname ('Connector');if (screenrun<>0) or (mvrun<>0 ) then BEGINifMsgbox ('Setup has detected that the client is running. '# -# - 'Click Yes to close the process, continue uninstalling, or press No to exit! ', mbconfirmation, Mb_yesno) =Idno THEN BEGIN Result:=false;// Setup ExitsEndElsebegin
if more than two judgment conditions are required, they should be judged separately at the time of execution .if screenrun<>0Then begin PostMessage (Mainrun, -,0,0);//exiting the main processend; if mvrun<>0Then begin PostMessage (Mvrun, -,0,0);//exiting the connector processend; deltree (Expandconstant ('{app}'), True, true, true); // Remove all folders from the installation location after exiting the process Result:=true;// The Setup program continuesend; EndElsebegin Result:=true; If no process is detected, continue to install the program end;end;
Inno Setup Uninstall before exiting the process, deleting the folder