How to get EA to access sounds in C: > Program Files (x86) > MetaTRader 4 > Sounds?

 

Hi all!

I'm trying to use the PlaySound() function, and my EA is grabbing the sound files from my MT4 install's data folder. There are somehow a couple of files in that folder, but the ones I want are in the MT4 application folder in Program Files (x86).

How can I get my EA to look in the latter instead of the former?

 
MT4 is a 32 bit program. You won't have anything in “\Program Files”. It is installed in “\Program Files (x86)”
 
William Roeder #:
MT4 is a 32 bit program. You won't have anything in “\Program Files”. It is installed in “\Program Files (x86)”

I shorthanded that a little, I'll edit for clarity. The sound files I'm looking for are in \Program Files (x86).

 
rrsch #: I shorthanded that a little, I'll edit for clarity. The sound files I'm looking for are in \Program Files (x86).

MetaTrader is "sandboxed" and only allows the function PlaySount() to access sound files in its designated directory (and subdirectories): "<terminal_directory>\Sounds".

EDIT: Corrected the above file location!

PlaySound - Common Functions - MQL4 Reference
PlaySound - Common Functions - MQL4 Reference
  • docs.mql4.com
PlaySound - Common Functions - MQL4 Reference
 
Fernando Carreiro #:

MetaTrader is "sandboxed" and only allows the function PlaySount() to access sound files in its designated directory (and subdirectories): "<Data Folder>\Sounds".

It's "terminal_directory\Sounds " directory Fernando, not "Data folder".
 
Alain Verleyen #: It's "terminal_directory\Sounds " directory Fernando, not "Data folder".
Thank you for correcting me!
 
Fernando Carreiro #:

MetaTrader is "sandboxed" and only allows the function PlaySount() to access sound files in its designated directory (and subdirectories): "<terminal_directory>\Sounds".

EDIT: Corrected the above file location!

Ok, so basically I'd have to manually put the sounds I want in that folder, it sounds like...?

 

You can also put your .wav files into the \MQL4\Files\ folder


if ( !PlaySound("\\Files\\sound.wav") )
{
   Print("PlaySound() failed to play the sound file.");
}
 
Arne Dale Valum #:

You can also put your .wav files into the \MQL4\Files\ folder


Sweet, thanks! I'll look into that.

Strangely now though, my sounds are still playing even after I remove them from the data folder Sounds folder, so I can't test the method you share here.

Reason: