Download MetaTrader 5
To add comments, please log in or register
Deposit to your account in any convenient way. There are 4 of them here!
sunshineh
1064
sunshineh 2016.09.06 14:23 

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?

whroeder1
13656
whroeder1 2016.09.06 14:48  
  1. You can't from mql4. You'd have to shell the file
  2. Disk space is cheap, just copy the file. Or make a hard link to it: fsutil hardlink create soundsDirectory existingFile
Fernando Carreiro
1571
Fernando Carreiro 2016.09.06 14:48  

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.
JC
1395
JC 2016.09.06 15:09  
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 */);
}
sunshineh
1064
sunshineh 2016.09.06 16:38  

Great!!!

Thank you very much!

/
To add comments, please log in or register