Skip to content
⌘ NSIS Forum Archive

do event when installer maximize\minimize

4 posts

r2du-soft#

do event when installer maximize\minimize

i know Function .onGUIEnd occurs when installer closed...
now i want show a message when installer minimized and minimized,how do know installer minimized or maximized?
Anders#
Show a message where? The user minimized the installer because they wanted to focus on something else, please don't be rude and nag the user...
r2du-soft#
Originally Posted by Anders View Post
Show a message where? The user minimized the installer because they wanted to focus on something else, please don't be rude and nag the user...
Mr Anders
i crate a .nsi file with this codes and in that and compile that:

!include "nsDialogs.nsh"


Page Custom PageOne
Page Custom PageTwo

XPStyle on



Section
SectionEnd



Function PageOne
nsDialogs::Create PageOne
		Pop $2
		#-------------------------------------
			System::Call "User32::MoveWindow(i, i, i, i, i, i) b ($2, 0, 0, 800, 515, TRUE)"
			SetCtlColors "$2" 0xffffff 0xffffff
			SetCtlColors "$HWNDPARENT" 0xffffff 0xffffff
		#-------------------------------------

		#-------------------------------------
			GetDlgItem $R1 $HWNDPARENT 1
			EnableWindow $R1 0

			
			GetDlgItem $R2 $HWNDPARENT 2
			EnableWindow $R2 0

			
			GetDlgItem $R3 $HWNDPARENT 3
			EnableWindow $R3 0

			
			GetDlgItem $R1 $HWNDPARENT 1
			EnableWindow $R1 1

			
			GetDlgItem $R2 $HWNDPARENT 2
			EnableWindow $R2 1

			
			GetDlgItem $R3 $HWNDPARENT 3
			EnableWindow $R3 1
		#-------------------------------------
nsDialogs::Show
FunctionEnd



Function PageTwo
nsDialogs::Create PageTwo
		Pop $2
		#-------------------------------------
			System::Call "User32::MoveWindow(i, i, i, i, i, i) b ($2, 0, 0, 800, 515, TRUE)"
			SetCtlColors "$2" 0xffffff 0xffffff
			SetCtlColors "$HWNDPARENT" 0xffffff 0xffffff
		#-------------------------------------

		#-------------------------------------
			GetDlgItem $R1 $HWNDPARENT 1
			EnableWindow $R1 0

			
			GetDlgItem $R2 $HWNDPARENT 2
			EnableWindow $R2 0

			
			GetDlgItem $R3 $HWNDPARENT 3
			EnableWindow $R3 0

			
			GetDlgItem $R1 $HWNDPARENT 1
			EnableWindow $R1 1

			
			GetDlgItem $R2 $HWNDPARENT 2
			EnableWindow $R2 1

			
			GetDlgItem $R3 $HWNDPARENT 3
			EnableWindow $R3 1
		#-------------------------------------
nsDialogs::Show
FunctionEnd






Function .onGUIInit
		Call RemoveTitleBar
		Call ResizeNsisGUI
		Call CenterNSISMainWindowOnNearestMonitor
		MoveAnywhere::Hook
FunctionEnd






Function RemoveTitleBar
		System::Call 'user32::SetWindowLong(i $HWNDPARENT,i -16,i 339871820)' #RemoveTitleBar
		GetDlgItem $0 $HWNDPARENT 0
		ShowWindow $0 ${SW_HIDE}
		ShowWindow $0 ${SW_SHOW}
		GetDlgItem $0 $HWNDPARENT 2
		ShowWindow $0 ${SW_HIDE}
		ShowWindow $0 ${SW_SHOW}
		GetDlgItem $0 $HWNDPARENT 1
		ShowWindow $0 ${SW_HIDE}
		ShowWindow $0 ${SW_SHOW}
FunctionEnd






Function CenterNSISMainWindowOnNearestMonitor
		System::Store S
		!if "${NSIS_PACKEDVERSION}" <= 0x0300003F
		System::Call '*(i,i,i,i,i,i,i,i,i,i)p.r5'
		System::Call "USER32::GetWindowRect(p$HWNDPARENT,ir5)"
		!else
		System::Call "USER32::GetWindowRect(p$HWNDPARENT,@r5)"
		!endif
		System::Call '*$5(i.r6,i.r7,i.r8,i.r9)'
		IntOp $6 $8 - $6
		IntOp $7 $9 - $7
		System::Call 'USER32::SystemParametersInfo(i0x30,i0,pr5,i0)'
		System::Call '*$5(i.r1,i.r2,i.r3,i.r4)'
		System::Call 'USER32::MonitorFromWindow(p$HWNDPARENT,i2)i.r0'
		IntCmpU $0 0 calcAndMove
		System::Call '*$5(i40)'
		System::Call 'USER32::GetMonitorInfo(pr0,pr5)i.r0'
		IntCmpU $0 0 calcAndMove
		System::Call '*$5(i,i,i,i,i,i.r1,i.r2,i.r3,i.r4)'
		calcAndMove:
		IntOp $1 $3 - $1
		IntOp $2 $4 - $2
		IntOp $6 $6 / 2
		IntOp $7 $7 / 2
		IntOp $1 $1 / 2
		IntOp $2 $2 / 2
		IntOp $1 $1 - $6
		IntOp $2 $2 - $7
		System::Call 'USER32::SetWindowPos(p$HWNDPARENT,i,ir1,ir2,i,i,i0x11)'
		!if "${NSIS_PACKEDVERSION}" <= 0x0300003F
		System::Free $5
		!endif
		System::Store L
FunctionEnd

Function ResizeNsisGUI
		System::Call 'USER32::SetWindowPos(p$HWNDPARENT,i,i,i,i700,i500,i0x12)' ; Set the size to something stupid
FunctionEnd


when i open exe file,if i click on my application is runed in start menu then application minimized,and if after that i click on that again my application maximized but next button and cancel button loaded after several second...i want solve this problem...
Anders#
Try
System::Call 'USER32::SetWindowPos(p$HWNDPARENT,i,i,i,i700,i500,i0x16)' ; Set the size to something stupid
If that does not help, comment out stuff until you find the problem.