How to check CComVariant.boolval is valid and extract bool value from it
-
I want ot check CComVariant.boolval is valid and extract bool value from it
if(SUCCEEDED(m_abc->GetProperty("test", comVar)))
{
if (comVar.boolVal == VARIANT_TRUE)
{
//should enter if true and valid, but enters if invalid case as well
}
}please help!
-
I want ot check CComVariant.boolval is valid and extract bool value from it
if(SUCCEEDED(m_abc->GetProperty("test", comVar)))
{
if (comVar.boolVal == VARIANT_TRUE)
{
//should enter if true and valid, but enters if invalid case as well
}
}please help!
-
I want ot check CComVariant.boolval is valid and extract bool value from it
if(SUCCEEDED(m_abc->GetProperty("test", comVar)))
{
if (comVar.boolVal == VARIANT_TRUE)
{
//should enter if true and valid, but enters if invalid case as well
}
}please help!
You must also check the
vt
member. When expecting a boolean value, it must beVT_BOOL
. When the requested property exists but did not contain a value,VT_EMPTY
orVT_NULL
are returned (the return type depends on the property value type).