Click here to Skip to main content
14,304,170 members

C / C++ / MFC

 
GeneralRe: Condition variable question Pin
focusdoit4-Aug-18 16:30
memberfocusdoit4-Aug-18 16:30 
GeneralRe: Condition variable question Pin
Richard MacCutchan4-Aug-18 20:57
protectorRichard MacCutchan4-Aug-18 20:57 
QuestionA Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer2-Aug-18 5:00
memberD_code_writer2-Aug-18 5:00 
AnswerRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x642-Aug-18 13:00
professionalRichard Andrew x642-Aug-18 13:00 
AnswerRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x642-Aug-18 13:06
professionalRichard Andrew x642-Aug-18 13:06 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer2-Aug-18 20:24
memberD_code_writer2-Aug-18 20:24 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x643-Aug-18 2:41
professionalRichard Andrew x643-Aug-18 2:41 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer3-Aug-18 12:45
memberD_code_writer3-Aug-18 12:45 
Richard,

Copy that - I actually figured it out. I found an old VC++ 6 project called MMFAPP1. That actually worked. Here is the crux of the fix.

Declare the following variables,

HANDLE m_hFileMMF;      // memory mapped file
    LPVOID m_pViewMMFFile;       // view of file, contains text in edit box


Then create the file handle,

m_hFileMMF = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,0,4*1024,"MyMMF");              
    DWORD dwError = GetLastError();
    if ( ! m_hFileMMF )
    {
        MessageBox(_T("Creation of file mapping failed"));
    }
    else
    {
        m_pViewMMFFile = MapViewOfFile(m_hFileMMF,FILE_MAP_ALL_ACCESS,0,0,0);                         // map all file

        if(! m_pViewMMFFile )
        {
            MessageBox(_T("MapViewOfFile function failed"));
        }
    }


Once that is done to write the data to the shared memory we have

PhysicsStruct s_physics;

if(m_pViewMMFFile )
			CopyMemory(m_pViewMMFFile,&s_physics,sizeof(PhysicsStruct));


To read from the shared memory we have,

if(m_pViewMMFFile )
			CopyMemory((PVOID)&s_physics,m_pViewMMFFile,sizeof(SPageFilePhysics));


I tested that and it worked like a charm. Also many thanks to the guy who wrote MMFAPP1 in the first place. It saved my neck. Also Richard thanks for your help as well.
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x643-Aug-18 13:44
professionalRichard Andrew x643-Aug-18 13:44 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer3-Aug-18 14:05
memberD_code_writer3-Aug-18 14:05 
QuestionCEditCtrl in FrameWnd Pin
john56321-Aug-18 23:50
memberjohn56321-Aug-18 23:50 
AnswerRe: CEditCtrl in FrameWnd Pin
Richard MacCutchan2-Aug-18 0:35
protectorRichard MacCutchan2-Aug-18 0:35 
AnswerRe: CEditCtrl in FrameWnd Pin
Jochen Arndt2-Aug-18 0:51
mveJochen Arndt2-Aug-18 0:51 
AnswerRe: CEditCtrl in FrameWnd Pin
Victor Nijegorodov2-Aug-18 1:01
memberVictor Nijegorodov2-Aug-18 1:01 
QuestionRun CFile::Open as admin Pin
_Flaviu1-Aug-18 21:47
member_Flaviu1-Aug-18 21:47 
AnswerRe: Run CFile::Open as admin Pin
Jochen Arndt1-Aug-18 22:54
mveJochen Arndt1-Aug-18 22:54 
GeneralRe: Run CFile::Open as admin Pin
_Flaviu1-Aug-18 23:00
member_Flaviu1-Aug-18 23:00 
Questionexecl in c++ example Pin
Shaul.amir30-Jul-18 22:12
memberShaul.amir30-Jul-18 22:12 
AnswerRe: execl in c++ example Pin
Jochen Arndt30-Jul-18 23:02
mveJochen Arndt30-Jul-18 23:02 
Questionhelp me~ for use..... #define macro ## #@ # Pin
dsyoon ds29-Jul-18 17:00
memberdsyoon ds29-Jul-18 17:00 
AnswerRe: help me~ for use..... #define macro ## #@ # Pin
Daniel Pfeffer29-Jul-18 20:45
professionalDaniel Pfeffer29-Jul-18 20:45 
QuestionThe new upgrade system Pin
Anthony Appleyard28-Jul-18 12:50
memberAnthony Appleyard28-Jul-18 12:50 
AnswerRe: The new upgrade system Pin
Anthony Appleyard28-Jul-18 18:35
memberAnthony Appleyard28-Jul-18 18:35 
GeneralRe: The new upgrade system Pin
Richard MacCutchan28-Jul-18 22:20
protectorRichard MacCutchan28-Jul-18 22:20 
AnswerRe: The new upgrade system Pin
Victor Nijegorodov28-Jul-18 21:22
memberVictor Nijegorodov28-Jul-18 21:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.