The reason for the compile error is that VarSupports is defined as taking a Variant
, and you are passing an OleVariant
.
It looks to me as if the code is trying to assign the OVStyleSheet
to the IHTMLStyleSheet
interface StyleSheet. In C++ Builder, you should be able to just assign it, as in
_di_IInterface inter = _di_IInterface(OVStyleSheet);
StyleSheet = inter;
If that succeeds and StyleSheet
is not NULL, you should be able to use StyleSheet
. Note that invalid Variant assignments can throw an exception, so you might want to handle that (and assume that the exception also means that the OVStyleSheet
does not support the IHTMLStyleSheet
interface)
Also, C++ Builder has an Interface.Supports function that appears to do what VarSupports does, except that VarSupports takes a variant, so Interface.Supports also requires you to obtain the interface from the OleVariant yourself. Probably something like:
di_IInterface inter = _di_IInterface(OVStyleSheet);
if (inter->Supports(StyleSheet))
{
ShowMessage("StyleSheet has been assigned");
}
This compiles, but I have not tested it.