You should not try to detect this. This is, or might be, a serious issue you are facing. There are several posibilities here and non of them are good. You are seeing a warning of some object that has been destroyed. Either the CString you are using is a dereferenced object where a delete was called on the pointer or considering you are using COM, you could also be facing something else. Considder e.g.:
BSTR m_TheString;
Do::This(string value)
{
m_TheString = CComBSTR(value.c_str());
}
and a bit later you are making a CString from the BSTR you'll find that the BSTR m_TheString is already destroyed. In order to prevent this you'll have to call CComBSTR(value.c_str()).Detach();
note that you'll have to free the memory later yourself!!
Anyway; if you'r not facing this try running the Microsoft application verifier. that will warn you of any memory issues you might be facing.
=========> Edit <==================
I have to correct myself here; I just ran a small test and though I mentioned a few things that would make sure that your app will not function correctly, the issue you are seeing can easily be created in the following manner:
char test[20];
CString apple(test);
=========> /Edit <==================
Hope this helps,
Cheers AT