We are working on converting the wiki to a static website controlled by markdown files in https://github.com/nsis-community. You can already see there how plug-ins will be posted. The end-user interface will still be a website but with a fresh coat of paint. Come meet us at Discord to talk about it.
WinAPI:winmm:PlaySound
| Author: sag47 (talk, contrib) |
PlaySound Function
References:
This will play a WAV file. It is a function that is part of winmm.dll. It is very easy to play the sound too.
Asynchronous Playing
The following code will start playing the WAV file as your installer continues. This is good if you want a little entertainment with a long install.
Function .onInit InitPluginsDir File /oname=$PLUGINSDIR\sound.wav "batcave.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' FunctionEnd
Stopping the Sound
Simply call the following code anywhere in your installer (has to be within a function, macro, or section). The sound/music will immediately stop once it is called.
System::Call 'winmm::PlaySound(i, i, i) b'
Synchronous Playing
This will play the sound but the installer won't continue until the sound is finished playing.
Function .onInit InitPluginsDir File /oname=$PLUGINSDIR\sound.wav "batcave.wav" ; Play the sound or song StrCpy $0 "$PLUGINSDIR\sound.wav" System::Call 'winmm::PlaySound(t r0, i, i) b' FunctionEnd
keyword "Play Sound"