Casting CString as _variant_t 
Author Message
 Casting CString as _variant_t

The example in the book says to do _variant_t
("Product"), for example.  How do I use a CString
variable instead of "Product"?  I.E. how do I
cast a CString as a _variant_t?

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sat, 27 Jul 2002 03:00:00 GMT  
 Casting CString as _variant_t
Try this:
        CString sFoo("Product");
        _variant_t(sFoo.GetBuffer(1));
or
        _variant_t((LPSTR)sFoo);


Quote:
> The example in the book says to do _variant_t
> ("Product"), for example.  How do I use a CString
> variable instead of "Product"?  I.E. how do I
> cast a CString as a _variant_t?

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Sun, 28 Jul 2002 03:00:00 GMT  
 Casting CString as _variant_t
CString str("Some String");

_variant_t var((LPCTSTR) str);

Quote:

> The example in the book says to do _variant_t
> ("Product"), for example.  How do I use a CString
> variable instead of "Product"?  I.E. how do I
> cast a CString as a _variant_t?

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Sun, 28 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CString cast to LPCTSTR cast error

2. CString cast to LPCTSTR cast error

3. CString cast to LPCTSTR cast error

4. Help - Filling _variant_t with CString

5. Using CString functionality without CString variable/cast operator

6. Using CString functionality without CString variable/cast operator

7. How to cast CString* to CString

8. CString problem with LPCSTR cast SHFILEOPSTRUCT member

9. CString Not Being Cast Correctly For ostrstream Operations

10. CString to Unicode (LPWSTR) Casting

11. casting CString to char?

12. Beginner: Casting a CString into a char*?

 

 
Powered by phpBB® Forum Software