如何在单击按钮后关闭自定义窗口事件-nsis

如何在单击按钮后关闭自定义窗口事件-nsis,nsis,Nsis,我有以下代码: Function fnc_custom_page GetDlgItem $0 $HWNDPARENT 2 ; Find cancel button System::Call *(i,i,i,i)i.r1 System::Call 'USER32::GetWindowRect(ir0,ir1)' System::Call *$1(i.r2,i.r3,i.r4,i.r5) IntOp $5 $5 - $3 ;height IntOp $4 $4 - $2 ;width IntOp $

我有以下代码:

Function fnc_custom_page
GetDlgItem $0 $HWNDPARENT 2 ; Find cancel button
System::Call *(i,i,i,i)i.r1
System::Call 'USER32::GetWindowRect(ir0,ir1)'
System::Call *$1(i.r2,i.r3,i.r4,i.r5)
IntOp $5 $5 - $3 ;height
IntOp $4 $4 - $2 ;width
IntOp $4 $4 + 50
System::Call 'USER32::ScreenToClient(i$HWNDPARENT,ir1)'
System::Call *$1(i.r2,i.r3)
System::Free $1
IntOp $2 $2 - $4 ;x
IntOp $2 $2 - 8  ;x+padding
System::Call 'USER32::CreateWindowEx(i0,t "Button",t "Open tch",i${WS_CHILD}|${WS_VISIBLE}|${WS_TABSTOP},ir2,ir3,ir4,ir5,i $HWNDPARENT,i 0x666,i0,i0)i.r0'
SendMessage $HWNDPARENT ${WM_GETFONT} 0 0 $1
SendMessage $0 ${WM_SETFONT} $1 1
GetFunctionAddress $R0 fnc_tch
ButtonEvent::AddEventHandler 0x666 $R0

nsDialogs::Show
FunctionEnd

Function fnc_tch
Exec "$INSTDIT\tch.exe" 
Abort
FunctionEnd
我只有一页,我不想显示任何其他内容。如果我单击打开tch,则应运行tch.exe并退出安装程序;但我无法使安装程序退出。 任何输入请


上述代码的来源:

大多数情况下,您可以使用
退出
,但与插件相关的回调函数不会处理它(退出标志不是插件API的一部分)

另一种方法是模拟单击关闭按钮:

!include WinMessages.nsh
SendMessage $HwndParent ${WM_CLOSE} 0 0

我不认为这是一个好主意,但我已经使用taskkill在安装程序完成我需要的工作后杀死它