Home | History | Annotate | Download | only in Windows
      1 // Windows/PropVariantConv.h
      2 
      3 #ifndef __PROP_VARIANT_CONV_H
      4 #define __PROP_VARIANT_CONV_H
      5 
      6 #include "../Common/MyTypes.h"
      7 
      8 // provide at least 32 bytes for buffer including zero-end
      9 bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime = true, bool includeSeconds = true) throw();
     10 void ConvertFileTimeToString(const FILETIME &ft, wchar_t *s, bool includeTime = true, bool includeSeconds = true) throw();
     11 
     12 // provide at least 32 bytes for buffer including zero-end
     13 // don't send VT_BSTR to these functions
     14 void ConvertPropVariantToShortString(const PROPVARIANT &prop, char *dest) throw();
     15 void ConvertPropVariantToShortString(const PROPVARIANT &prop, wchar_t *dest) throw();
     16 
     17 inline bool ConvertPropVariantToUInt64(const PROPVARIANT &prop, UInt64 &value)
     18 {
     19   switch (prop.vt)
     20   {
     21     case VT_UI8: value = (UInt64)prop.uhVal.QuadPart; return true;
     22     case VT_UI4: value = prop.ulVal; return true;
     23     case VT_UI2: value = prop.uiVal; return true;
     24     case VT_UI1: value = prop.bVal; return true;
     25     case VT_EMPTY: return false;
     26     default: throw 151199;
     27   }
     28 }
     29 
     30 #endif
     31