EQuestionAnswers.com Computer/Electronics Questions and Answers
C, C++, VC++, COM/DCOM, DLL and more
#Login #Sign up  Facebook Twitter TGoogle+

#Previous question #Index of COM/DCOM Questions #Next question


Variant is a generic variable type in VB and Java script or VC++ automation.

Variant is a type to hold any data type or array of any type. Thus Variant is constructed as structure with a field to hold data type (VARTYPE vt) and another field to hold the value. All type of variables are union to this field.

VARIANT type definition

typedef /* [wire_marshal] */ struct tagVARIANT VARIANT;

struct  tagVARIANT
    struct  __tagVARIANT
      VARTYPE vt;
      WORD wReserved1;
      WORD wReserved2;
      WORD wReserved3;
        LONG lVal;
        BYTE bVal;
        SHORT iVal;
        FLOAT fltVal;
        DOUBLE dblVal;
        VARIANT_BOOL boolVal;
        _VARIANT_BOOL bool;
        SCODE scode;
        CY cyVal;
        DATE date;
        BSTR bstrVal;
        IUnknown __RPC_FAR *punkVal;
        IDispatch __RPC_FAR *pdispVal;
        SAFEARRAY __RPC_FAR *parray;
        BYTE __RPC_FAR *pbVal;
        SHORT __RPC_FAR *piVal;
        LONG __RPC_FAR *plVal;
        FLOAT __RPC_FAR *pfltVal;
        DOUBLE __RPC_FAR *pdblVal;
        VARIANT_BOOL __RPC_FAR *pboolVal;
        _VARIANT_BOOL __RPC_FAR *pbool;
        SCODE __RPC_FAR *pscode;
        CY __RPC_FAR *pcyVal;
        DATE __RPC_FAR *pdate;
        BSTR __RPC_FAR *pbstrVal;
        IUnknown __RPC_FAR *__RPC_FAR *ppunkVal;
        IDispatch __RPC_FAR *__RPC_FAR *ppdispVal;
        SAFEARRAY __RPC_FAR *__RPC_FAR *pparray;
        VARIANT __RPC_FAR *pvarVal;
        PVOID byref;
        CHAR cVal;
        USHORT uiVal;
        ULONG ulVal;
        INT intVal;
        UINT uintVal;
        DECIMAL __RPC_FAR *pdecVal;
        CHAR __RPC_FAR *pcVal;
        USHORT __RPC_FAR *puiVal;
        ULONG __RPC_FAR *pulVal;
        INT __RPC_FAR *pintVal;
        UINT __RPC_FAR *puintVal;
        struct  __tagBRECORD
          PVOID pvRecord;
          IRecordInfo __RPC_FAR *pRecInfo;
          }	__VARIANT_NAME_4;
        }	__VARIANT_NAME_3;
      }	__VARIANT_NAME_2;
    DECIMAL decVal;
    }	__VARIANT_NAME_1;

/* CComVariant is a wrapping class */
class CComVariant : public tagVARIANT

Sample Code

V_VT(&va) = VT_I4;
V_I4(&va) = i;
hret = windows->Item(va,&disp); 

You have viewed 1 page out of 66. Your COM/DCOM learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

# COM DCOM Interview Questions and Answers :: ALL Interview .com
# COM DCOM - COM DCOM Interview Questions
# COM interview questions | TechInterviews
# COM Interview Questions - CodeProject
# Com Dcom Interview Questions - Com and Dcom in Asp Net
# ATL Interview Questions and Answers :: ALL Interview .com
# ActiveX Interview Questions and Answers :: ALL Interview .com

* #1 webmaster Mon 28 Apr/2014 18:11:25(GMT)  Like 0 Unlike 0

Dear Users,

We are pleased to inform you that a forum/blog has been incorporated with www.mybestnotes.co.in. You are welcomed to add your comments, requests, codes, solutions and feedback to it. Please login(if already a member) or signup(for free) to avail to this facility.


Your message goes here:

My Post:*
Secutiry Code: ******  *
Preview this compose before posting this in discussion forum.
  1. Use [Sxx] code to show smiles. Example [S02]
  2. Use [URL ], example [URL http://www.google.com/]
  3. To display code or un formatted text use [CODE] [/CODE]. Example: [CODE] printf("Hello world"); [/CODE]
 [S01]   [S02]   [S03]   [S04]   [S05]   [S06]   [S07]   [S08] 
 [S09]   [S10]   [S11]   [S12]   [S13]   [S14]   [S15]   [S16] 
 [S17]   [S18]   [S19]   [S20]   [S21]   [S22]   [S23]   [S24] 

Note: Only members are allowed, * fields are mandatory.