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

rrsch  

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?

William Roeder  
MT4 is a 32 bit program. You won't have anything in “\Program Files”. It is installed in “\Program Files (x86)”
rrsch  
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).

Fernando Carreiro  
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
Alain Verleyen  
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".
Fernando Carreiro  
Alain Verleyen #: It's "terminal_directory\Sounds " directory Fernando, not "Data folder".
Thank you for correcting me!
rrsch  
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...?

Arne Dale Valum  

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.");
}
Reason: