How to Change Type of a VARIANT

Posted by nimo on Stack Overflow See other posts from Stack Overflow or by nimo
Published on 2010-05-05T04:52:46Z Indexed on 2010/05/05 4:58 UTC
Read the original article Hit count: 155

Filed under:
|

Hi,

I'm having a VARIANT with its type set to VT_R8. Subsequently I need to change its type to VT_BSTR.

I would like know whether there is a way of resetting a VARIANT status.

Thus, I noticed that every time I set value to the VARIANT (in my case, its double) , VARIANT itself set its bstrVal member to a bad pointer, even though I set bstrVal member to NULL at the initialization of VARIANT. Why such thing is happening ?

Is it safe to use a VARIANT as structure where both dbVal and bstrVal member are set ?

Please clarify, thank you.

© Stack Overflow or respective owner

Related posts about automation

Related posts about com