Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
The issues have been:
1. FILE_MAP_ALL_ACCESS is an argument of MapViewOfFile but not for CreateFileMapping
2. FILE_MAP_ALL_ACCESS only works if the hdl was created with PAGE_READWRITE access
3. The written, received members should be volatile so that changes on them were recognized even if the waswritten or wasreceived were inlined.
4. The setxy must not have the condition 'myPtrMem->iswritten() == false'. That was a copy-paste error
5. The getxy must not have the condition 'myPtrMem->isreceived() == false'. That was a copy-paste error
Note, the solution was the ANSI version. If using UNICODE project settings the name of the shared memory must be passed as wide string L'MySharedMem' and the char* turned to wchar_t* (or you call CreateFileMappingA explicitly).
Open in new window