I have this structure:
Code:
struct MYSTRUCT {
const char* var1;
const char* var2;
const char* var3;
};
And then I create a MYSTRUCT variable and send it like so:
Code:
MYSTRUCT mystruct = (MYSTRUCT){"text","test","more text"};
SendMessage(hListBox, LB_SETITEMDATA, x, (LPARAM)&mystruct);
And then I recieve my structure variable like so:
Code:
MYSTRUCT* mystructure = (MYSTRUCT*)SendMessage(hListBox, LB_GETITEMDATA, x, 0);
Now, my problem is, I want to modify the values of the three varX variables in the structure. I've tried this:
Code:
GetDlgItemText(hVar1, temp_var, 255);
mystructure->var1 = temp_var;
GetDlgItemText(hVar2, temp_var, 255);
mystructure->var2 = temp_var;
GetDlgItemText(hVar3, temp_var, 255);
mystructure->var3 = temp_var;
SendMessage(hListBox, LB_SETITEMDATA, x, (LPARAM)mystructure);
The problem with that is that all the values of the varX variables are equivalent to the value of the var3 variable. I'm pretty sure I'm doing something wrong, but I'm not sure how to fix it. I'm sorry if this is in the wrong section because I know I have some win32 code, but I think my problem is with the memory and actual values conflicting which is c++.