
!include "WinMessages.nsh"

Name "Banner Move Test"

OutFile "banner.exe"

ShowInstDetails show

!define RECT '(i,i,i,i) i'
!define SWP_NOSIZE 1
!define STEPX 5
!define STEPY 5
!define STEPS 20
!DEFINE INTERVAL 30

Function .onInit
	Banner::show /NOUNLOAD "Calculating important stuff..."
	Banner::getWindow /NOUNLOAD
	Pop $0
	Sleep 500
	System::Call '*${RECT} .r1' ; allocates memory for RECT struct and writes address to $1
	System::Call 'user32::GetWindowRect(i r0, i r1) i .r2'
	System::Call "*$1${RECT}(.r3,.r4,,)"
	System::Free $1
loop:
        Sleep ${INTERVAL}
	IntOp $3 $3 - ${STEPX}
	IntOp $4 $4 - ${STEPY}
	System::Call 'user32::SetWindowPos(i r0, i 0, i r3, i r4, i 0, i 0, i ${SWP_NOSIZE}) i r2'
	IntOp $7 $7 + 1
	IntCmp $7 ${STEPS} 0 loop
	Sleep 1000
	Banner::destroy
FunctionEnd

Section
	DetailPrint "Using previous calculations to quickly calculate 1*2000..."
	Sleep 1000
	DetailPrint "Eureka! It's $0!!!"
	DetailPrint ""
SectionEnd