今天查一个问题,我们的产品在运行是,点击安装,会报错,找到一个结束进程的控件processwork.dll
下载地址:
http://www.esanu.name/programs/NSISKillProcess.html 将processwork.dll放到Plugins目录下,然后在NSIS代码中加入如下函数:
Function CloseParentWithUserApproval
Push $5
loop:
push "*.exe"
processwork::existsprocess
pop $5
IntCmp $5 0 done
MessageBox MB_RETRYCANCEL|MB_ICONSTOP “Your process must be closed during this installation.$\r$\n Close your process now, or press Retry to automatically close and continue or press Cancel to cancel the installation entirely.“ IDCANCEL BailOut
push "*.exe"
processwork::KillProcess
Sleep 2000
Goto loop
BailOut:
Abort
done:
Pop $5
FunctionEnd
新创建的非模态对话框,失去焦点时也会显示在最前,使用很不方便。
取消此特性的方法如下:
(1)将Dialog的属性“Application Window”设置为True,以便在对话框可见时在任务栏显示图标。
(2)将Dialog的属性“System Modal”和“Topmost”分别设置为False。
(3)创建代码:
CDialog* pModeDlg = new CDialog(NULL);
pModeDlg ->Create(IDD_DIALOG_MODE, GetDesktopWindow());
pModeDlg ->ShowWindow(SW_SHOWNA);