cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
pman626
Level 2

how to add mp3 audio and play in background during installation?

I have an mp3 file I want to loop during installation.

how do I add it and make it play after the user selects the installation path?

i'm looking at the installation designer and don't see where
Labels (1)
0 Kudos
(1) Reply
Cary_R
Level 11

Hi There,

There's definitely no support for something like this in InstallShield, other than the ability to write custom actions.

If you've got some familiarity with programming, I whipped this up based on some samples for playing media via Visual C++(although you'll want to take this as an Example, since it's not terribly robust):

[CODE]

#include "Mmsystem.h"
#include "Windows.h"
#include "MSI.h"
#include "MsiQuery.h"

unsigned int __stdcall PlayMMFileUntilMSIDone(MSIHANDLE hInstall)
{
CString sVerb;
DWORD nbuffer;
nbuffer = 255;
TCHAR* filepath = new TCHAR[255];
TCHAR* isFinished = new TCHAR[2];
unsigned int retVal;

retVal = MsiGetProperty(hInstall,_T("SOUNDTRACK"),filepath,&nbuffer);
sVerb = _T("open \"") + (CString)filepath;

sVerb = sVerb + _T("\" type mpegvideo alias MediaFile");
mciSendString(sVerb, NULL, 0, 0);
mciSendString(_T("play MediaFile repeat"), NULL, 0, 0);

while((CString)isFinished!=_T("1"))
{
nbuffer = 255;
retVal = MsiGetProperty(hInstall,_T("SoundtrackFinished"),isFinished,&nbuffer);
Sleep(1000);
}

mciSendString(_T("stop MediaFile"), NULL, 0, 0);
return 0;
}[/CODE]

This works by having you set a property, "SOUNDTRACK" to the path of your *.mp3 file, and then having something else set the "SoundtrackFinished" property to "1" when you want the music to stop.

In my test project I basically just used 2 set property custom actions, and stored the *.mp3 file in the Support Files, so the path it set for SOUNDTRACK was:

[SUPPORTDIR]\Frank Sinatra - Girl from Ipanema.mp3

Hope this helps!

Regards,

Cary
0 Kudos