i have taken an look into std:: but didnt find an example on how to replace an part of the string.
You dont need to understand the overall code.
The basic here is
File a contains "Itm_mPartName.dds" this is stored in PropItem->szIcon
Now in here we get the szIcon make it into string so it can be replaced by something else.
Its part of an large source code of an Game. However that game has been developed many years ago and its an bit outdated. So thats why i am upgrading and improve it. But this cost time. So first things first.
By looking at MSDN documentation here is what they say about CString::Replace
https://msdn.microsoft.com/en-us/library/aa300582(v=vs.60).aspx
Now if I understood correctly, it's should be obvious why replacement in your example does not work.
You are replacing a char with string, but CString::Replace does not provide that functionality.
ignore above, maybe checking return value should help, it must not be 0.