在此之前,我知道在NSIS制作安装文件过程中需要关掉某些程序,都是通过findwindow来实现。
今天发现这个 processwork.dll 这个插件特好用,直接找进程,杀进程,爽快啊。
官方网站在:http://www.esanu.name/programs/NSISKillProcess.html
可以下到processwork.dll文件,放到Plugins目录后,就可以用了。例如:
Function CloseParentWithUserApproval
Push $5
loop:
push "msimn.exe"
processwork::existsprocess
pop $5
IntCmp $5 0 done
MessageBox MB_RETRYCANCEL|MB_ICONSTOP
'Outlook Express must be closed during
this installation.$/r$/n
Close Outlook Express now,
or press "Retry" to automatically close
Outlook Express and continue or press
"Cancel" to cancel the
installation entirely.' IDCANCEL BailOut
push "msimn.exe"
processwork::KillProcess
Sleep 2000
Goto loop
BailOut:
Abort
done:
Pop $5
FunctionEnd
有兴趣的可以试用一下哈