;NSIS ModelessBanner Test
;Written by Takhir Bedertdinov

;--------------------------------
;common

!define APP_NAME "ModelessBanner"
  !include "MUI.nsh"
  Name "${APP_NAME}"
  OutFile "${APP_NAME}.exe"
  InstallDir "$PROGRAMFILES\${APP_NAME}"

;--------------------------------
;Pages

  !insertmacro MUI_PAGE_WELCOME
  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_INSTFILES
  !insertmacro MUI_UNPAGE_FINISH

  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES
  !insertmacro MUI_UNPAGE_FINISH
  
;--------------------------------
;Interface Settings

  !define MUI_ABORTWARNING
  
;--------------------------------
;Languages
 
  !insertmacro MUI_LANGUAGE "English"

  Var hwin
;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

  StrCpy $4 $hwin
  MessageBox MB_OK "Is Banner visible? HideWindow($4) is our next call :)"
  System::Call 'user32.dll::ShowWindow(i r4, i 0) i .r3'
; Destroy not works - probably another thread.
;  System::Call 'user32.dll::DestroyWindow(i r4) i .r3'

SectionEnd

!define IMG_NAME "tango.bmp"
!define SND_NAME "09.mp3"

;--------------------------------
;Installer Functions

Function .onInit

  InitPluginsDir
  SetOutPath $PLUGINSDIR
  File "${IMG_NAME}"
  File "${SND_NAME}"
  System::Call 'msvfw32.dll::MCIWndCreate(i 0, i 0,i 0x0070, t "$PLUGINSDIR\${SND_NAME}") i .r0'
  SendMessage $0 0x0806 0 0
;  SendMessage $0 0x0472 0 1
  System::Call 'kernel32::GetModuleHandle(i 0) i .r0'
  System::Call 'user32.dll::LoadImage(i r0, t "${IMG_NAME}", i 0, i 0, i 0, i 0x0010) i .r1'
  System::Call 'user32.dll::CreateWindowEx(i 8, t "STATIC", t "", i 0x8000000E, i 50, i 50, i 200, i 200, i 0, i 0, i r0, i 0) i .r2'
;  MessageBox MB_OK "CreateWindowEx returned $2"
  SendMessage $2 0x0172 0 $1
  System::Call 'user32.dll::ShowWindow(i r2, i 1) i .r3'
  System::Call 'user32.dll::UpdateWindow(i r2) i .r3'
  StrCpy $hwin $2

FunctionEnd


;--------------------------------
;Descriptions

