I'm trying to understand the code in the SDK help for the SetPropValue function:
What's specifically bothering me is how it reallocates the entire edit data structure for one string...what about the other values in there, and what if I have multiple strings (and I do)? I'm not sure what to do here because either reallocation deletes the old edit data structure so I can't copy the old stuff from it, or it doesn't and I can but then this code doesn't ever delete the old edit data structure.
// Gets the string
LPSTR pStr = (LPSTR)((CPropDataValue*)pValue)->m_pData;
// You can simply poke the string if your EDITDATA structure has a fixed size,
// or have an adaptive size of structure like below
// If the length is different
// Asks MMF to reallocate the structure with the new size
LPEDATA pNewPtr = (LPEDATA)mvReAllocEditData(mV, edPtr, sizeof(EDITDATA)+strlen(pStr));
// If reallocation worked
// Copy the string
// Same size : simply copy
And either way, I'm still very confused about how this works - for instance, how does MMF2 know what to save and load with the MFA and how to do it? I've been looking through the way properties work and I still haven't figured out anything in terms of strings and other dynamic memory...