This class is derived from the VARIANT structure. This means you can pass a COleVariant in a parameter that calls for a VARIANT and that the data members of the VARIANT structure are accessible data members of COleVariant
你只要查一下VARIANT就知道了,一般是用VARIANT的bstrVal成员,不过要注意bstrVal是BSTR型的。

解决方案 »

  1.   

    VARIANT variant;
    variant.ChangeType(BSTR?)
    CString str;
    str = variant.bstrVal;
      

  2.   

    COleVariant  vValue1;
    CString cName;
    cName=vValue1.bstrVal;
      

  3.   

    VARIANT variant;
    variant.ChangeType(VT_BSTR)
    CString str;
    str = variant.bstrVal;
      

  4.   

    那怎么把一个 ANSI字符串的数据赋给一个 VARIANT 变量,即VT_BSTRT类型的数据
      

  5.   

    COleVariant( lpszSrc, vtSrc )   Copies a string into the new object. The parameter vtSrc must be VT_BSTR (UNICODE) or VT_BSTRT (ANSI).