-
-WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant)
-{
- ClearVariant(&oleVariant);
- if (variant.IsNull())
- {
- oleVariant.vt = VT_NULL;
- return true;
- }
-
- wxString type(variant.GetType());
-
-
- if (type == wxT("long"))
- {
- oleVariant.vt = VT_I4;
- oleVariant.lVal = variant.GetLong() ;
- }
- // cVal not always present
-#ifndef __GNUWIN32__
- else if (type == wxT("char"))
- {
- oleVariant.vt=VT_I1; // Signed Char
- oleVariant.cVal=variant.GetChar();
- }
-#endif
- else if (type == wxT("double"))
- {
- oleVariant.vt = VT_R8;
- oleVariant.dblVal = variant.GetDouble();
- }
- else if (type == wxT("bool"))
- {
- oleVariant.vt = VT_BOOL;
- // 'bool' required for VC++ 4 apparently
-#if (defined(__VISUALC__) && (__VISUALC__ <= 1000))
- oleVariant.bool = variant.GetBool();
-#else
- oleVariant.boolVal = variant.GetBool();
-#endif
- }
- else if (type == wxT("string"))
- {
- wxString str( variant.GetString() );
- oleVariant.vt = VT_BSTR;
- oleVariant.bstrVal = wxConvertStringToOle(str);
- }
-#if wxUSE_DATETIME
- else if (type == wxT("datetime"))
- {
- wxDateTime date( variant.GetDateTime() );
- oleVariant.vt = VT_DATE;
-
- long dosDateTime = date.GetAsDOS();
- short dosDate = short((dosDateTime & 0xFFFF0000) >> 16);
- short dosTime = short(dosDateTime & 0xFFFF);
-
- DosDateTimeToVariantTime(dosDate, dosTime, & oleVariant.date);
- }
-#endif
- else if (type == wxT("void*"))
- {
- oleVariant.vt = VT_DISPATCH;
- oleVariant.pdispVal = (IDispatch*) variant.GetVoidPtr();
- }
- else if (type == wxT("list") || type == wxT("stringlist"))