foobar
foobar

Reputation: 2941

NSIS: Maximize/Minimize Button event Handling

I want to know how can I handle the event when I click the maximize button(I have enabled it already) of my nsis dialog. I want to perform some other dialog element resizing every time I click maximize button, and restore when its minimized. So, how can I achieve it??? Please help. Thanks in advance.

Upvotes: 1

Views: 581

Answers (1)

Anders
Anders

Reputation: 101736

NSIS was really not designed to handle re-sizable dialogs.

The only way to catch a size event would be to use a plugin. You could write your own custom plugin or try the experimental WndSubclass plugin, either way you pretty much need to know a bit about the Windows API to do this...

Edit:

!include nsDialogs.nsh
!include WinCore.nsh
!include WndSubclass.nsh
!macro _Win_HIWORD_FIXED _outvar _in
IntOp ${_outvar} "${_in}" >> 16 ;sign extended
${LOWORD} ${_outvar} ${_outvar} ;make sure we strip off the upper word
!macroend
!undef HIWORD
!define HIWORD "!insertmacro _Win_HIWORD_FIXED "

Var ParentSubProc
Function ParentSubProc
${If} $2 = ${WM_SIZE}
    ${LOWORD} $1 $4
    ${HIWORD} $2 $4
    ${NSD_SetText} $hwndparent "Size: $1 x $2"
${EndIf}
FunctionEnd

Function .onGuiInit
${NSD_AddStyle} $hwndparent 0x70000
${WndSubclass_Subclass} $hwndparent ParentSubProc $ParentSubProc $ParentSubProc
FunctionEnd

Upvotes: 1

Related Questions