Some experience of using CString.
CString str1;
str1+= "abc";
str1+= "efg";
Finally you will get str1: "abcefg".
but if you do this:
LPSTR lpstr=str1.GetBuffer( someLength );
and you change the content of str1 by lpstr.
Then if you do
CString str2="hello";
str2+=str1;
The result of str2 will not be "hello" plus the content of str1.
Because the str1 is broken when you change the content through lpstr.
A better idea to recover str1 is
CString str3(lpstr);
then use str3 instead of str1.
CString str1;
str1+= "abc";
str1+= "efg";
Finally you will get str1: "abcefg".
but if you do this:
LPSTR lpstr=str1.GetBuffer( someLength );
and you change the content of str1 by lpstr.
Then if you do
CString str2="hello";
str2+=str1;
The result of str2 will not be "hello" plus the content of str1.
Because the str1 is broken when you change the content through lpstr.
A better idea to recover str1 is
CString str3(lpstr);
then use str3 instead of str1.