文章 "一个使用命名管道在 MetaTrader 5 客户端之间进行通信的无 DLL 解决方案" - 页 3

 
考虑到 mql4/5 缺乏多线程的可能性,在 mql4/5 上制作服务器就像看电子管电视一样(看似有效,但感觉却不一样。 这就是为什么最好编写一个单独的服务器,并用它在 mql 程序之间传输数据。
 
你好,这个产品 还能使用吗?如果不是,能否更新到最新的 MT5 版本?现在它抛出了一个 "访问违规 "问题
 

在调用 writeTick、readTick......等方法时,我还遇到了访问违规错误。请查看附件中已修复的 CNamedPipes 文件

我还在 CNamedPipe 类中添加了 WriteDouble 方法

#import "kernel32.dll"
...
int WriteFile(ulong fileHandle,double &var,int bytes,int &numOfBytes,ulong overlapped);
...
#import

...

bool CNamedPipe::WriteDouble(double data)
  {
   int data_size = sizeof(data);
//--- 检查参数
   if(!data || data_size<1) return(false);

//--- 发送数据
   int written;
   if(!WriteFile(hPipe,data,data_size,written,NULL) || written!=data_size)
      return(false);
//--- ok
   return(true);
  }


附注:要在客户端读/写(例如从另一个 Metatrader 终端),我只是使用了标准的 MQL5 FilePipe 库。如何使用它们的示例可在此处下载:


https://www.mql5.com/zh/articles/503

Communicating With MetaTrader 5 Using Named Pipes Without Using DLLs
Communicating With MetaTrader 5 Using Named Pipes Without Using DLLs
  • www.mql5.com
Many developers face the same problem - how to get to the trading terminal sandbox without using unsafe DLLs. One of the easiest and safest method is to use standard Named Pipes that work as normal file operations. They allow you to organize interprocessor client-server communication between programs. Take a look at practical examples in C++ and MQL5 that include server, client, data exchange between them and performance benchmark.
附加的文件:
 
奇功
 
很久没有更新了...当我将指标附加到图表时,我看到了 "访问违规 "错误。看来没办法让它工作了。