chinajiang
May 29th, 1999, 03:31 PM
When I use some controls in VC,there have some function 's parameter type is VARIANT, how to invoke this type function?
Please help me!
Please help me!
|
Click to See Complete Forum and Search --> : VARIANT chinajiang May 29th, 1999, 03:31 PM When I use some controls in VC,there have some function 's parameter type is VARIANT, how to invoke this type function? Please help me! Wayne Fuller May 29th, 1999, 07:57 PM A VARIANT is a structure that contains all of the OLE types. It doesn't actually contain them, it is a union of them. So a VARIANT type occupies 12 bytes. Check out the documentation on http://msdn.microsoft.com. Basically the structure consists of the following. struct VARIANT { VARTYPE vt; union { Byte bVal; // VT_UI1. Short iVal; // VT_I2. long lVal; // VT_I4. float fltVal; // VT_R4. double dblVal; // VT_R8. ... and so on You use it like the following. VARIANT var; // I am setting up the variant to hold a long value. var.vt = VT_I4; var.lVal = (long) 5; There are also helper classes to help with the VARIANT structure. MFC has a class, COleVariant, and there is a class, I use this one personally, defined in <comdef.h> called _variant_t. Check it out. Hope this helps, Wayne codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |