I have a method that takes in a System::String^ and internally obtains a VARIANT. I want to compare the var.bstrVal with my string and it never seems to find a match even though I know it does. Here is the code (NOTE: I have updated this with more detail):
System::String^ filterName = "MyStringThatMatches";
//pass to method and code to build up the VARIANT called var...
IPropertyBag *pPropBag;
pMoniker->BindToStorage(0, 0, IID_PPV_ARGS(&pPropBag));
VARIANT var;
VariantInit(&var);
pPropBag->Read(L"FriendlyName", &var, 0);
pin_ptr<const wchar_t> convertedFilter = PtrToStringChars(filterName);
if (0 == wcscmp(var2.bstrVal, convertedFilter))
So the wcscmp never finds a match. I thought I was on the right track here.. Any ideas?