I have the below code:
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
I have only one page, and I do not want to show any thing else. If I click open tch, tch.exe should run and installer should exit; but I am not able to make installer exit. Any input please.
Source for above code: NSIS: How to add custom button to left bottom corner and handle it's click?
Most of the time you can use Quit
but plugin related callback functions do not handle it (The quit flag is not a part of the plugin API).
The alternative is to emulate a click on the close button:
!include WinMessages.nsh
SendMessage $HwndParent ${WM_CLOSE} 0 0