|
#include "Sdk.h"
#include "VariantUtils.h"
HRESULT
Variant_SetBool(
VARIANT *Variant,
BOOL Value
) {
if(Variant == NULL) {
return E_POINTER;
}
V_VT(Variant) = VT_BOOL;
V_BOOL(Variant) = Value ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
HRESULT
Variant_SetLong(
VARIANT *Variant,
LONG Value
) {
if(Variant == NULL) {
return E_POINTER;
}
V_VT(Variant) = VT_I4;
V_I4(Variant) = Value;
return S_OK;
}
HRESULT
Variant_SetString(
VARIANT *Variant,
LPCWSTR Value
) {
BSTR bstr = NULL;
if(Variant == NULL) {
return E_POINTER;
}
if(Value == NULL) {
return E_INVALIDARG;
}
bstr = SysAllocString(Value);
if(bstr == NULL) {
return E_OUTOFMEMORY;
}
V_VT(Variant) = VT_BSTR;
V_BSTR(Variant) = bstr;
return S_OK;
}
HRESULT
Variant_SetDispatch(
VARIANT *Variant,
IDispatch *Value
) {
if(Variant == NULL) {
return E_POINTER;
}
V_VT(Variant) = VT_DISPATCH;
if(Value == NULL) {
V_DISPATCH(Variant) = NULL;
}
else {
IDispatch_QueryInterface(Value,
&IID_IDispatch,
(void **)&(V_DISPATCH(Variant))
);
}
return S_OK;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.