Click here to Skip to main content
15,867,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dynamically create memory based on 2 different struture templates Pin
manoharbalu14-Jun-17 20:27
manoharbalu14-Jun-17 20:27 
GeneralRe: Dynamically create memory based on 2 different struture templates Pin
Richard MacCutchan14-Jun-17 22:40
mveRichard MacCutchan14-Jun-17 22:40 
GeneralRe: Dynamically create memory based on 2 different struture templates Pin
manoharbalu14-Jun-17 22:44
manoharbalu14-Jun-17 22:44 
GeneralRe: Dynamically create memory based on 2 different struture templates Pin
Richard MacCutchan14-Jun-17 23:18
mveRichard MacCutchan14-Jun-17 23:18 
GeneralRe: Dynamically create memory based on 2 different struture templates Pin
manoharbalu15-Jun-17 0:34
manoharbalu15-Jun-17 0:34 
GeneralRe: Dynamically create memory based on 2 different struture templates Pin
Richard MacCutchan15-Jun-17 1:11
mveRichard MacCutchan15-Jun-17 1:11 
GeneralRe: Dynamically create memory based on 2 different struture templates Pin
leon de boer15-Jun-17 8:06
leon de boer15-Jun-17 8:06 
GeneralRe: Dynamically create memory based on 2 different struture templates Pin
manoharbalu15-Jun-17 19:54
manoharbalu15-Jun-17 19:54 
Thanks a lot. You have answered and explained what I had asked for. But I have a few hurdles to implement it.

I already have created the MFC application with a single structure defined in it. The global variable pointer for this structure struct1 is created and used through out the application.
As I had already said this MFC application invokes a console application at a time based on the user selection. There are many nearly some 1000 console applications which already are working. The MFC application creates a shared memory using CreateFileMapping and assigns the structure struct1 pointer to MapViewOfFile. The console application shares the same memory using the same struct1. So the same pointer name is used in both the MFC and all the console applications at many places.

Now my requirement is I have to increase the size and add some of the members in the struct1 to create struct2 for some of the console applications. So Now there will be some console applications that have struct1 and others have struct2. But the MFC application is a common application which invokes any particular console applications based on the selection. But there will be one mfc application and console application running at a time and sharing the memory. So If the MFC application invokes console application of type1 it should create a memory for struct1 and it creates memory for struct2 for console application of type2. The MFC application knows the type of console application at runtime and the pointer to be changed to point to either struct1 or struct2. And the pointer is already used in many many places in various console applications.

Is there a way in the mfc application to redefine the global pointer at runtime to make it point to struct1 or struct2 based on the console application type.

Eg: test->a[1000] = 23; //This usage code cannot be changed since used in many places

Note: Only common member variables are used in the MFC application. Hence the above line in the example will work for struct1 as well as for struct2 as both contains the member variable 'a' of the same type
GeneralRe: Dynamically create memory based on 2 different struture templates Pin
leon de boer16-Jun-17 4:14
leon de boer16-Jun-17 4:14 
QuestionValue for a structure is not showing in watch window in VS2008 Pin
manoharbalu12-Jun-17 1:14
manoharbalu12-Jun-17 1:14 
AnswerRe: Value for a structure is not showing in watch window in VS2008 Pin
Richard MacCutchan12-Jun-17 6:26
mveRichard MacCutchan12-Jun-17 6:26 
GeneralRe: Value for a structure is not showing in watch window in VS2008 Pin
manoharbalu12-Jun-17 19:14
manoharbalu12-Jun-17 19:14 
GeneralRe: Value for a structure is not showing in watch window in VS2008 Pin
leon de boer12-Jun-17 20:57
leon de boer12-Jun-17 20:57 
QuestionHooking file move with shell extension? Pin
TheHeadlessSourceMan10-Jun-17 21:25
TheHeadlessSourceMan10-Jun-17 21:25 
AnswerRe: Hooking file move with shell extension? Pin
Jochen Arndt11-Jun-17 0:34
professionalJochen Arndt11-Jun-17 0:34 
GeneralRe: Hooking file move with shell extension? Pin
Richard MacCutchan11-Jun-17 1:20
mveRichard MacCutchan11-Jun-17 1:20 
QuestionDisable a textbox based on combo box choice Pin
lolici7-Jun-17 23:07
lolici7-Jun-17 23:07 
AnswerRe: Disable a textbox based on combo box choice Pin
Jochen Arndt7-Jun-17 23:37
professionalJochen Arndt7-Jun-17 23:37 
GeneralRe: Disable a textbox based on combo box choice Pin
lolici8-Jun-17 3:44
lolici8-Jun-17 3:44 
GeneralRe: Disable a textbox based on combo box choice Pin
Jochen Arndt8-Jun-17 4:37
professionalJochen Arndt8-Jun-17 4:37 
GeneralRe: Disable a textbox based on combo box choice Pin
lolici8-Jun-17 11:01
lolici8-Jun-17 11:01 
GeneralRe: Disable a textbox based on combo box choice Pin
Jochen Arndt8-Jun-17 21:17
professionalJochen Arndt8-Jun-17 21:17 
QuestionOverload -> operator Pin
_Flaviu6-Jun-17 23:54
_Flaviu6-Jun-17 23:54 
AnswerRe: Overload -> operator Pin
Jochen Arndt7-Jun-17 0:43
professionalJochen Arndt7-Jun-17 0:43 
GeneralRe: Overload -> operator Pin
_Flaviu7-Jun-17 1:56
_Flaviu7-Jun-17 1:56 

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.