- 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!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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?