Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Yerim Rayann Gon Diarra:
CreateFileMappingA
CreateFileMappingA
I am not familiar with that particular Windows API, but you can read its documentation here: CreateFileMappingA function
CreateFileMappingA function (winbase.h) - Win32 apps
- 2022.07.27
- GrantMeStrength
- learn.microsoft.com
Creates or opens a named or unnamed file mapping object for a specified file. (CreateFileMappingA)
I found the issue, hope it will help others.
I changed all the integer type (in the define section) to long type.
Since my mt5 run on a 64-bits architecture, the INVALID_HANDLE_VALUE should have been casted to long, because windows was expecting a long value.
But it's only the case for mt5 that run on 64-bits architecture, if you plate-forme run on 32-bites architecture you will be fine using int.
To know the architecture of your Plateform you can use the built in function : IsX64()
Also the issue was extending to the use of the MapViewOfFile function.
After calling CreateFileMapping (), Windows was sending back handle that were 64-bites. Thus those handle were meant to be stored on a long variable (because long type have more space than int type) (and 64-bites handle are meant to be stored in long values).
But since I stored them in integer variable (wich is smaller) some data got lost making the handle I stored different from the handle that windows sent to me.
So here is the link to the code that helped me find the issues https://www.mql5.com/en/code/818
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
Hi fellows coders,
I tried to use Shared memory (through File Mapping), by first setting up the required space using CreateFileMapping.
But i kept getting error 6 <=> INVALID_HANDLE ( the error is collected through the following function kernel32::GetLastError() ).
Even tho i tried multiples variations.
Below i will attach the code of each variation i used.
May be i'm just brain dead, but if you spot the issues, let me know ! THANKS