Good afternoon
I can't connect from C++ Builder project.
Here is the code
void __fastcall TForm1::FormActivate(TObject *Sender) { AnsiString path_MemMap32=ExtractFileDir(ParamStr(0)) + "\\dll\\MemMap32.dll"; AnsiString path_file="Local\\Monitor_USDCHF"; wchar_t * UnicodeString = new wchar_t[path_file.WideCharBufSize()]; path_file.WideChar(UnicodeString,path_file.WideCharBufSize()); delete [] UnicodeString; int (__stdcall *MemOpen) (char * path,int size,int mode,int &err); void (__stdcall *MemClose)(int hmem); int (__stdcall *MemRead)(int hmem, int v[], int pos, int sz, int &err); HINSTANCE hDLL= LoadLibrary(path_MemMap32.c_str()); if(!hDLL) {StatusBar1->SimpleText="I can't load dll";} else {StatusBar1->SimpleText="path_MemMap32.dll load";} MemOpen= (int(__stdcall *)(char * path,int size,int mode,int &err)) GetProcAddress(hDLL,"MemOpen"); MemClose=(void(__stdcall*)(int hmem)) GetProcAddress(hDLL,"MemClose"); MemRead= (int(__stdcall *)(int hmem, int v[], int pos, int sz, int &err)) GetProcAddress(hDLL,"MemRead"); hmem=MemOpen(path_file.c_str(),-1,0,err); StatusBar1->SimpleText=err; }
The status bar says 2 i.e. file not found, I tried both in ansi and in unicode to send the path to the file
In MT5 file Expert Advisor created a file and updates quotes in it.
If you have C++, why did you decide to use a DLL?
The source code is fully available there.
If you have C++, why did you decide to use a DLL?
The source code is fully available there.
I wanted to use a ready-made DLL.
so that there would be no problems with MT4-5.
... I'll try to see the source code of the dll
I wanted to use the ready-made dll.
so that there would be no problems with sparring in MT4-5.
... I'll try to see the source code of the dll.
What is your Windows?
win7x64
I can't write in builder.
and I can't write it like this.
#include <vcl.h> #include <stdafx.h> #include "BuySell.h"I get it.
[C++ Fatal Error] afxv_w32.h(14): F1003 Error directive: WINDOWS.H already included. MFC apps must not #include <windows.h>
I tried to connect first
afxv_w32.h
didn't help
I tried plugging in afxwin.h first - it didn't help either.
I tried plugging in afxwin.h first - it didn't help either.
look for connected afx.h as another option.
Yes, so it is without errors I will try further. Thank you.
...
I got it. Everything works.
But CloseHandle doesn't close for some reason.
I have a server in the exe (creates updates and should close) and in the terminal there is a receiver, so after CloseHandle in the server it sees the failed object in memory.
I have a server in the echo (it updates and closes it) and a receiver in the terminal, so after CloseHandle in the server it sees the failed object in memory.
and you expect that memory should be completely cleared when the handle is closed?
Good afternoon
Please tell me the direction of thought development.
There is a task to distribute signals within one computer (server) on many terminals, critical delays of more than 1-3 ms.
implemented in a bundle of client-server, 1-2 accounts work acceptable and not to hang the terminal made reading from memory using Sleep(1) in a loop - if the memory takes the necessary value then perform some action. But when terminals even 5 terminals, 1 ms here is not doable otherwise the cooler on the processor starts howling ...
I haven't followed the news for a long time, maybe in mt5 there are custom events similar to OnTrade so that they can be linked to memory modification.
I tried reading without delays 100 000 cycles (8 bytes each) passes in 670 ms.
... maybe I should reduce the data to 4 bytes.
... there is probably another option to rebuild your dll to loop it inside - not returning data until they do not accept the required values. but how MT5 will react to such a long wait for return from an external function is another question.
There is a task to distribute signals within one computer (server) to many terminals, delays of more than 1-3 ms are critical.
implemented in the client-server bundle, 1-2 accounts work acceptably and not to hang the terminal made reading from memory using Sleep(1) in a loop - if the memory takes the necessary value we perform some action. But when terminals even 5 terminals, 1 ms here is not doable otherwise the cooler on the processor starts howling ...
I haven't followed the news for a long time, maybe in mt5 there are user events similar to OnTrade so that they can be linked to memory modification.
In your case, only the server has the right to modify the memory. Clients read it.
- Look in the direction of Pipe. there "events" of data arrival are realised as self-explanatory - data is available, no data, we wait.
Yes, the server will have to be written or copied from MSDN, but ready-made clients can be used directly in MQL5.
Unfortunately, there is no way to deal with the periodicity of polling here either. Sleep(1) in such a number of Expert Advisors should not make noise even when working with memory. You need to check the timing of functions, maybe there are extra passes and load somewhere.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Quotes Monitoring (memory-mapped file):
This Expert Advisor is example of use of the Memory Mapping DLL for working with File Mapping functions.
In this example the Expert Advisor create a virtual (memory-mapped) file and start to update the quotes on symbol. Using this way, Expert Advisors can exchange data (for example, quotes) using common memory-mapped file.
Author: Alex Sergeev