Play external Sound File

 

Hi,

the function PlaySound(...) plays the soundfile that must be located in terminal_directory\Sounds or its sub-directory.

How can I play a sound file from the C:\Windows\Media path?

 

I can think of two possibilities:

  • Either, use a DLL call to the WinAPI for that
  • or add a Junction Point to the "terminal_directory\Sounds" to point to other media folders.
 
sunshineh:

Hi,

the function PlaySound(...) plays the soundfile that must be located in terminal_directory\Sounds or its sub-directory.

How can I play a sound file from the C:\Windows\Media path?

An adaptation of https://www.mql5.com/en/forum/148934:

#import "winmm.dll"
   int PlaySoundW(string, int, int);
#import

void OnStart()
{
   PlaySoundW("c:\\windows\\media\\chimes.wav", 0, 1 /* SND_ASYNC */);
}
 

Great!!!

Thank you very much!