Reputation: 7458
I have a variant that contains a BSTR, but sometimes the BSTR is "" (empty), so how to avoid this? I have tried something like:
variant.bstrVal != NULL
But it didn't work.
Upvotes: 6
Views: 10359
Reputation: 1
You can test the vt
member of VARIANT for VT_NULL
or VT_EMPTY
if (variant.vt != VT_NULL)
{
...
}
Upvotes: -2
Reputation: 1677
Use SysStringLen
:
if (SysStringLen(variant.bstrVal) == 0)
{ ... }
Upvotes: 23