Archive: oninit+after


oninit+after
Hey. First off all, I'm pretty new to this whole nsis script thing. Now...I've been modifying the zip2exe classic script and managed pretty well, it does what it's supposed to but I can't get the cosmetics of the installer to work the way I want. What I want is to have a BMP (with an logo) fade in while music starts playing and then have it fade out while the music continues to play throughout the installer as it'll be a long installation. As it is now the music starts playing and then stops as the BMP fades out...

My code looks like this:
Page license
Page instfiles

XPStyle on
ShowInstDetails hide

BrandingText " "

LicenseText "Before continuing the installation process you must read through and accept this installer's license."
LicenseData "${NSISDIR}\Contrib\lala2.txt"
Icon "${NSISDIR}\contrib\lala1.ico"

Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\sound.wav "${NSISDIR}\Contrib\lala3.wav"

; Play the sound or song
StrCpy $0 "$PLUGINSDIR\sound.wav" ; location of the wav file
IntOp $1 "SND_ASYNC" || 1
System::Call 'winmm::PlaySound(t r0, i 0, i r1) b'

File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\lala4.bmp"

advsplash::show 1000 600 400 -1 $PLUGINSDIR\splash

FunctionEnd


Tryed everything I can think of, please help.


this code is insane, what is IntOp $1 "SND_ASYNC" || 1 supposed to do? you would also need SND_FILENAME, but you need to use the actual value, or ${SND_FILENAME} if it exists as a define...

Why would you even want to play a long music file? Think of your poor users


both Splash and AdvSplash are hardcoded to call PlaySound(0,0,0); and this will abort the playing file even if you did not give it anything to play, you could file a bug report about this if you really care, for now you must start playing the sound AFTER the splash and the code for that would look something like:

System::Call 'winmm::PlaySound(t "C:\WINDOWS\Media\winSpaceSysStart.wav", i 0,i 0x20001)'

(all parameters hardcoded here, replace path ofcourse)