You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
lib doesn't bind to sections, because theoretically the code can be executed in different processes.
To control it, use either your variant or https://www.mql5.com/en/code/1835 for example.
Did I understand correctly that if the mutex is named, I can get its handle from any process, not just metatrader?
Question for the author.
I use the class in mt4. If I switch off and switch on the terminal, everything stops working. The way out is not very convenient to delete Expert Advisors before switching off and attach them after switching on the terminal. Is there any way to circumvent this problem.
And the second. I cannot read the file mapping created by a programme written in Delphi. What can be the nuances.
Briefly, these are trading panels working on many terminals.
If you switch off and switch on the terminal, everything stops working. The way out is not very convenient to delete EAs before switching off and attach them after switching on the terminal. Is there any way to work around this problem?
It is necessary to log and see what happens with files during such deinitialisation. there are no any locks.
I can't read the file mapping
what function from winapi is meant by "read"?
It is necessary to log and see what happens to the files during such deinitialisation. there are no locks.
what function from winapi is meant by "read"?
The thing is, the function
always returns 0.
That's why I can't really understand if the file is open.
In the picture above is the log of the Expert Advisor opening a file mapping that hasn't been created yet. And there are no errors.
Maybe the function
CMemMapFile::Openshould be inserted not in int OnInit(), but somewhere further on, for example, in OnTick(), but since the returned handle is always 0, there is no possibility to make a check to avoid opening the file constantly with each tick.
And on the second question.
In Delphi I create an application that creates a file mapping. When connecting it, errors occur. Namely Not correctly passed numbers. I started aligning with {$Align Off}
I got other errors like Access violation read to 0x04E91000 in 'msvcrt.dll'.
Now the data is aligned normally by 19 bytes - "00:35:50.260 Panel v 1.00 GBPUSD.m,M5: OnInitsizeof(PipeData)= 19".
but when reading all data are zero.
The thing is that the function
always returns 0.
That's why I can't really understand if the file is open.
That's right, CMemMapFile::Open returns an error code or 0 when there is no error.
(unlike CMemMapApi:, which will return an open handle and write the error to the passed parameter).
And the handle is in m_hmem.
In delphi, you create an application that creates a file mapping. When connecting it, errors occur. Namely Not correctly passed numbers.
do you take into account the reserved DWORD bytes at the beginning of the file ?4 bytes? I'll try it, I didn't count it.
look at how the file is written or created in the source.
on the m_size parameter
is correct, CMemMapFile::Open returns an error code or 0 when there is no error.
(unlike CMemMapApi:, which will return an open handle and write the error to the passed parameter).
And the handle is in m_hmem.
Do you take into account the reserved DWORD bytes at the beginning of the file ?is m_hmem when opening a non-existent file mapping. How to determine if this is an error or a handle?
is m_hmem when opening a non-existent file mapping. How to determine if it is an error or a handle?