use of calldll

Robin Becker robin at jessikat.fsnet.co.uk
Fri Apr 19 08:25:57 EDT 2002


In article <84323230.0204190336.4dc51098 at posting.google.com>, Piero <picodello at yahoo.it> writes

Variant is defined thusly according to my docs which are probably slightly out of date.
Just ensure that the union bit is long enough for the longest of the things in it.
I think that's 8 bytes, but others may know more. When assigning ensure the vt is
set to the corresponding value ie 0 for lVal, 1 for bVal etc etc.

When reading you need to check vt to see how to interpret the memory
at the address of the union.

struct tagVARIANT {
    VARTYPE vt;
    WORD wReserved1;
    WORD wReserved2;
    WORD wReserved3;
    union {
    //  C++ Type      Union Name   Type Tag                Basic Type
    //  --------      ----------   --------                ----------
        long          lVal;        // VT_I4                ByVal Long
        unsigned char bVal;        // VT_UI1               ByVal Byte
        short         iVal;        // VT_I2                ByVal Integer
        float         fltVal;      // VT_R4                ByVal Single
        double        dblVal;      // VT_R8                ByVal Double
        VARIANT_BOOL  boolVal;     // VT_BOOL              ByVal Boolean
        SCODE         scode;       // VT_ERROR
        CY            cyVal;       // VT_CY                ByVal Currency 
        DATE          date;        // VT_DATE              ByVal Date
        BSTR          bstrVal;     // VT_BSTR              ByVal String
        IUnknown      *punkVal;    // VT_UNKNOWN 
        IDispatch     *pdispVal;   // VT_DISPATCH          ByVal Object
        SAFEARRAY     *parray;     // VT_ARRAY|*           ByVal array
        // A bunch of other types that don't matter here...
        VARIANT       *pvarVal;    // VT_BYREF|VT_VARIANT  ByRef Variant
        void          * byref;     // Generic ByRef        
    };
};


......
>Something can help on using VARIANT type in Python and CALLDLL
>
>Thanks
>
>Piero Dell'OSte

-- 
Robin Becker



More information about the Python-list mailing list