Play external Sound File
- You can't from mql4. You'd have to shell the file
- Disk space is cheap, just copy the file. Or make a hard link to it: fsutil hardlink create soundsDirectory existingFile
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!
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?