Add external Sound to EA
MQL4 Resources: Including resources to executable files during compilation of mql4 programs
- docs.mql4.com
MQL4 Resources: Including resources to executable files during compilation of mql4 programs
Thank you very much Fernando,
I was able to save the audio files in #resource. How can I call this resource audios to play? Using PlaySound ()? Can you give me an example, thank you.
It is right there in the documentation examples:
Use of Resources
Resource name
After a resource is declared using the #resource directive, it can be used in any part of a program. The name of the resource is its path without a backslash at the beginning of the line, which sets the path to the resource. To use your own resource in the code, the special sign "::" should be added before the resource name.
Examples:
//--- examples of resource specification and their names in comments #resource "\\Images\\euro.bmp" // resource name - Images\euro.bmp #resource "picture.bmp" // resource name - picture.bmp #resource "Resource\\map.bmp" // resource name - Resource\map.bmp #resource "\\Files\\Pictures\\good.bmp" // resource name - Files\Pictures\good.bmp #resource "\\Files\\Demo.wav"; // resource name - Files\Demo.wav" #resource "\\Sounds\\thrill.wav"; // resource name - Sounds\thrill.wav" ... //--- utilization of resources ObjectSetString(0,bitmap_name,OBJPROP_BMPFILE,0,"::Images\\euro.bmp"); ... ObjectSetString(0,my_bitmap,OBJPROP_BMPFILE,0,"::picture.bmp"); ... set=ObjectSetString(0,bitmap_label,OBJPROP_BMPFILE,1,"::Files\\Pictures\\good.bmp"); ... PlaySound("::Files\\Demo.wav"); ... PlaySound("::Sounds\\thrill.wav");
It is right there in the documentation examples:
Use of Resources
Resource name
After a resource is declared using the #resource directive, it can be used in any part of a program. The name of the resource is its path without a backslash at the beginning of the line, which sets the path to the resource. To use your own resource in the code, the special sign "::" should be added before the resource name.
Examples:
Thanks woked using "::filename.wav"
Is there any way to add new sounds without having to paste them in the meta trader sounds folder? I would like to do this for when i start to selling the EAs and it is not necessary for the client to copy and paste the new sounds in the meta trader folder .
Sorry my english,
Thanks .