Truckle, Andrew J wrote: > OK, I have done some further investigating. You can have multiple > categories, as the name of the method implies. But these are combined into > one string, sperated by commas. So that clarifies the matter. > > In my situation, I would only want to purge items that have just my category > alone, so this should still be correct: > > pAppt->get_Categories(&bstrCat); > > // Can we delete it? > if (bstrCat == "SoundRota") > { > > If there are other categories associated with the item (in the text string) > then I want to leave it well alone and assume it is not my item to be > purged. > > However, is my text comparison safe? I don't see any == operator defined > for this type of thing. It appears to work, but that could be by chance. > Is there more appropriate code to use for comparing this CComBSTR against > "SoundRota"?
Looking at <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_atl_ccombstr_class_members.asp>, the CComBSTR class does seem to have the operator==() function defined, so it should be safe to use. Of course, I'd suggest something like: if (bstrCat == L"SoundRota") ... so that the comparison takes place more efficiently (without any need for string conversion before comparison) but any of the two forms should work just fine. -- Ehsan Akhgari Farda Technology <http://www.farda-tech.com/> Windows is a colorful clown suit for DOS. _______________________________________________ msvc mailing list msvc@beginthread.com See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.