unsigned long to _variant_t 
Author Message
 unsigned long to _variant_t

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



Tue, 22 Jun 2004 00:24:41 GMT  
 unsigned long to _variant_t
_variant_t((long)mydwordvalue);
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


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



Tue, 22 Jun 2004 00:30:17 GMT  
 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



Tue, 22 Jun 2004 06:52:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. (unsigned int)(unsigned long)(void *)p

2. How to convert unsigned long to unsigned char?

3. Converting Unsigned Short to Unsigned long

4. How to get (unsigned char *) from _variant_t

5. format specifier for unsigned long long

6. printing unsigned long long problem

7. long vs unsigned long

8. unsigned long long int

9. UINT, LONG vs. unsigned, long

10. unsigned long to long without lossage (Help)

11. char size (was long long long long long int)

12. bytes to unsigned char, unsigned short, unsigned int, ...

 

 
Powered by phpBB® Forum Software