Hi,

Try this:
1. CString can be constructed (with the constructor!) getting a BSTR parameter. Write something like this:

CString str;
BSTR bstr;
str = CString(bstr);
...

2. You should make a copy of what AllocSysString returns (allocate space and copy).

Hope it works!