Domanda

I am new to using .dll's in Metatrader. I am trying to execute a file copy .dll. In my header I have the following:

#import "Kernel32.dll"
bool CopyFileA (string source_file, string destination_file, bool if_exist);

In my init(), for testing purposes, I have the following:

bool check = true;
check = CopyFileA ("c:\test.txt", "c:\Temp\test.txt", true);
Alert(check);

I have enabled "Allow DLL imports" in Options/Expert Advisers. So I initialize as true (so I know it's executing the check) but it always returns as false. Of course, I have made sure that test.txt exists as well as the Temp folder on my C drive.

I have tried both as backtesting and putting on a chart on forward test but it always returns false

Any advice on why this is happening? I'm sure it's something obvious but, like I said, new to .dll's. Thanks in advance.

È stato utile?

Soluzione

If you are using build 600, there is high chances are you have to use CopyFileW instead.

Metatrader 4 switched from Ansi to Unicode from build 509 to build 600.

see the following links:

CopyFileA or CopyFileW not working in new MT4 build600

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top