;NSIS MCI Sound Script Sample
;Written by Takhir Bedertdinov

;--------------------------------
;common

  !define APP_NAME "mci.sound"
  !define SND_NAME "tango.mp3"

  Name "${APP_NAME}"
  OutFile "${APP_NAME}.exe"
  InstallDir "$PROGRAMFILES\${APP_NAME}"

;--------------------------------
;Pages, Interface Settings, Languages

  !include "MUI.nsh"
  !insertmacro MUI_PAGE_WELCOME
  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_INSTFILES
  !insertmacro MUI_LANGUAGE "English"
  !define MUI_ABORTWARNING

;--------------------------------
; User Vars, safety, redundancy...
  Var hmci

;--------------------------------
;Installer Functions

Function .onInit

  InitPluginsDir
  SetOutPath $PLUGINSDIR
  File "${SND_NAME}"
  System::Call 'msvfw32.dll::MCIWndCreate(i 0, i 0,i 0x0070, t "$PLUGINSDIR\${SND_NAME}") i .r0'
; play or play+loop
;  SendMessage $0 0x0465 0 "STR:play"
  SendMessage $0 0x0465 0 "STR:play repeat"
; if you want mci window to be hidden
  System::Call 'user32.dll::ShowWindow(i r0, i 0)'
; for WM_CLOSE in SecDummy - optional
  StrCpy $hmci $0

FunctionEnd


;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy

; place your script here

; to stop sound at the end of INSTALL page - optional
  SendMessage $hmci 0x0010 0 0

SectionEnd
