
unsigned long to _variant_t
_variant_t doesn't support VT_UI4. You can make it VT_I4 by using Igor's
suggestion. Consider carefully if you need VT_UI4 - VB doesn't know
about it either... If you decide you need it, call _variant_t::ChangeType
with VT_UI4 after construction:
_variant_t vnt((long)mydwordvalue);
vnt.ChangeType(VT_UI4);
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
Quote:
> hey all
> Is there a way to make a VARIANT from a unsigned long value using one of
> the many default constructors provided for the _variant_t class.
> I mean
> DWORD mydwordvalue;
> LONG mylongvalue;
> I can do _variant_t(mylongvalue) and pass it as an argument to a function
> that requires a variant input but not variant_t(mydwordvalue).
> thanks
> Raj