Declare:
LPWSTR** lines= new LPWSTR*[totalLines];
then i set using:
lines[totalLines]=&totalText;
SetWindowText(totalChat,(LPWSTR)lines[totalLines]);
totalLines++;
Now I know totalText is right, cause if i SetWindowText using totalText it works fine. I need the text in totalLines too.
I'm also doing:
//accolating more memory.
int orgSize=size;
LPWSTR** tempArray;
if (totalLines == size) {
size *= 2;
tempArray = new LPWSTR*[size];
memcpy(tempArray, lines,sizeof(LPWSTR)*orgSize);
delete [] lines;
lines = tempArray;
}
to allocate more memory when needed.
My problem is that the lines is not getting the right data. It works for the first time around then it get corrupted. I thought at first i was overwriting but totalLines is increase. Hopefully this is enough information.