Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? Pin
Vaclav_24-May-12 3:39
Vaclav_24-May-12 3:39 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? Pin
Vaclav_24-May-12 7:31
Vaclav_24-May-12 7:31 
Questionnew and free Pin
pix_programmer23-May-12 0:23
pix_programmer23-May-12 0:23 
AnswerRe: new and free Pin
CPallini23-May-12 1:00
mveCPallini23-May-12 1:00 
GeneralRe: new and free Pin
pix_programmer23-May-12 1:13
pix_programmer23-May-12 1:13 
GeneralRe: new and free Pin
CPallini23-May-12 1:48
mveCPallini23-May-12 1:48 
AnswerRe: new and free Pin
«_Superman_»23-May-12 4:54
professional«_Superman_»23-May-12 4:54 
QuestionUnable to write to shared memory Pin
manoharbalu22-May-12 20:20
manoharbalu22-May-12 20:20 
I have a Delphi application which Creates a shared memory uses CreateFileMapping, OpenFileMapping, MapViewOfFile functions.

Now I wanted to share the same memory for my MFC application. I used the OpenFileMapping, MapViewOfFile functions.

I created a structure exactly same in size as the Delphi application and mapped the structure object.
sample code:
HANDLE hMapObject2;
hMapObject2 = OpenFileMapping( FILE_MAP_ALL_ACCESS, FALSE, "PP101U3_SHARED");
if( !hMapObject2 )
{
AfxMessageBox("Failed to open Simpack DataBase");
return( 0 );
}
Simpack = ( struct SIMPACKDB *) MapViewOfFile( hMapObject2, FILE_MAP_ALL_ACCESS, 0, 0, 0 );
if( !Simpack )
{
AfxMessageBox("Failed to create Simpack File Map View");
return(0);
}
Esim->SPV1 = Simpack->SP_Z;
I am able to read the values exactly correct for all the member variables in the structure.
But when I try to write value in the shared memory, its not changing. It shows the previous value immediately.

The value of Simpack->SP_Z[15] is 0.5010 as read
from the shared memory which is set by the Delphi application.

When I set or write the value of the same variable to the shared memory using the code:

Simpack->SP_Z[15] = 0.6123;it still shows the previous value 0.5010. When I change the same variables value in the Delphi application it changes and the changed value can be read here in the MFC application.

Please help me how to write the values in the shared memory. Is there anything wrong in the code?
AnswerRe: Unable to write to shared memory Pin
Malli_S22-May-12 20:34
Malli_S22-May-12 20:34 
GeneralRe: Unable to write to shared memory Pin
manoharbalu22-May-12 22:40
manoharbalu22-May-12 22:40 
AnswerRe: Unable to write to shared memory Repost Pin
Richard MacCutchan22-May-12 22:34
mveRichard MacCutchan22-May-12 22:34 
GeneralRe: Unable to write to shared memory Repost Pin
Richard Andrew x6423-May-12 12:08
professionalRichard Andrew x6423-May-12 12:08 
QuestionSyncronisation problem Pin
VCProgrammer22-May-12 20:13
VCProgrammer22-May-12 20:13 
AnswerRe: Syncronisation problem Pin
Malli_S22-May-12 20:45
Malli_S22-May-12 20:45 
AnswerRe: Syncronisation problem Pin
Erudite_Eric22-May-12 21:52
Erudite_Eric22-May-12 21:52 
AnswerRe: Syncronisation problem Pin
Richard MacCutchan22-May-12 22:33
mveRichard MacCutchan22-May-12 22:33 
AnswerRe: Syncronisation problem Pin
ThatsAlok23-May-12 3:55
ThatsAlok23-May-12 3:55 
Questionunable to write into the shared memory Pin
manoharbalu22-May-12 4:02
manoharbalu22-May-12 4:02 
AnswerRe: unable to write into the shared memory Pin
Richard Andrew x6422-May-12 4:08
professionalRichard Andrew x6422-May-12 4:08 
GeneralRe: unable to write into the shared memory Pin
manoharbalu22-May-12 4:14
manoharbalu22-May-12 4:14 
GeneralRe: unable to write into the shared memory Pin
Richard Andrew x6422-May-12 4:22
professionalRichard Andrew x6422-May-12 4:22 
GeneralRe: unable to write into the shared memory Pin
manoharbalu22-May-12 4:33
manoharbalu22-May-12 4:33 
AnswerRe: unable to write into the shared memory Pin
Richard Andrew x6422-May-12 4:36
professionalRichard Andrew x6422-May-12 4:36 
GeneralRe: unable to write into the shared memory Pin
manoharbalu22-May-12 4:50
manoharbalu22-May-12 4:50 
AnswerRe: unable to write into the shared memory Pin
Richard Andrew x6422-May-12 4:58
professionalRichard Andrew x6422-May-12 4:58 

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.