下载MetaTrader 5

win10 64位操作系统下在MT4中调用kernel.dll下的CopyFileW()不成功?

要添加评论,请登录注册
Ge Senlin
1410
Ge Senlin  
请问如何解决,32位系统正常
Xiangdong Guo
4380
Xiangdong Guo  
Ge Senlin:
请问如何解决,32位系统正常

葛大神好久未发言了,忙着收钱呢吧。。。哈哈哈

你的问题我在自己的 Win10 x64 上试了一下,运行正常。

//+------------------------------------------------------------------+
//| Import Windows DLL                                               |
//+------------------------------------------------------------------+
#import  "kernel32.dll"
  bool CopyFileW(string lpExistingFileName, string lpNewFileName, bool bFailIfExists);
#import

//+------------------------------------------------------------------+
//| Input Variables                                                  |
//+------------------------------------------------------------------+
input string SourceFileName = "aabbcc.txt";
input string DestinationFileName = "xxyyzz.txt";
input bool   OverWrite = true;

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart() {
  string data_folder = TerminalInfoString(TERMINAL_DATA_PATH),
         file_folder = data_folder + "\\MQL4\\Files\\",
         source_file = file_folder + SourceFileName,
         destination_file = file_folder + DestinationFileName;

  PrintFormat("Source file path=%s", source_file);
  PrintFormat("Destination file path=%s", destination_file);

  bool result = CopyFileW(source_file, destination_file, !OverWrite);
  PrintFormat("Result: %s", (result ? "Success" : "Fail"));
}
enbo lu
版主
1957
enbo lu  
Ge Senlin:
请问如何解决,32位系统正常
kernell.dll?

kernell32.dll

Ge Senlin
1410
Ge Senlin  

谢谢两位,问题已经解决,是文件路径问题

Ge Senlin
1410
Ge Senlin  
Xiangdong Guo:

葛大神好久未发言了,忙着收钱呢吧。。。哈哈哈

你的问题我在自己的 Win10 x64 上试了一下,运行正常。

哈哈,好久未来有点生疏了,多谢帮助

要添加评论,请登录注册