std::string TypeAsString(VARTYPE vt){
switch (vt){
case VT_EMPTY: return "VT_EMPTY";
case VT_NULL: return "VT_NULL";
case VT_I2: return "VT_I2";
case VT_I4: return "VT_I4";
case VT_R4: return "VT_R4";
case VT_R8: return "VT_R8";
case VT_CY: return "VT_CY";
case VT_DATE: return "VT_DATE";
case VT_BSTR: return "VT_BSTR";
case VT_DISPATCH: return "VT_DISPATCH";
case VT_ERROR: return "VT_ERROR";
case VT_BOOL: return "VT_BOOL";
case VT_VARIANT: return "VT_VARIANT";
case VT_DECIMAL: return "VT_DECIMAL";
case VT_RECORD: return "VT_RECORD";
case VT_UNKNOWN: return "VT_UNKNOWN";
case VT_I1: return "VT_I1";
case VT_UI1: return "VT_UI1";
case VT_UI2: return "VT_UI2";
case VT_UI4: return "VT_UI4";
case VT_INT: return "VT_INT";
case VT_UINT: return "VT_UINT";
case VT_VOID: return "VT_VOID";
case VT_HRESULT: return "VT_HRESULT";
case VT_PTR: return "VT_PTR";
case VT_SAFEARRAY: return "VT_SAFEARRAY";
case VT_CARRAY: return "VT_CARRAY";
case VT_USERDEFINED: return "VT_USERDEFINED";
case VT_LPSTR: return "VT_LPSTR";
case VT_LPWSTR: return "VT_LPWSTR";
case VT_BLOB: return "VT_BLOB";
case VT_STREAM: return "VT_STREAM";
case VT_STORAGE: return "VT_STORAGE";
case VT_STREAMED_OBJECT: return "VT_STREAMED_OBJECT";
case VT_STORED_OBJECT: return "VT_STORED_OBJECT";
case VT_BLOB_OBJECT: return "VT_BLOB_OBJECT";
case VT_CF: return "VT_CF";
case VT_CLSID: return "VT_CLSID";
case VT_VECTOR: return "VT_VECTOR";
case VT_ARRAY: return "VT_ARRAY";
default: return "???";
}
}
void __stdcall ShowVariantType(VARIANT *pVal)
{
#pragma EXPORT
std::string retVal;
char buf[20];
sprintf(buf, "0x%x = ", pVal->vt);
retVal = buf;
VARTYPE vt = pVal->vt;
if( V_ISARRAY(pVal) ){
retVal += "VT_ARRAY ";
vt &= ~VT_ARRAY; //remove the flag
}
if( V_ISBYREF(pVal) ){
retVal += "VT_BYREF ";
vt &= ~VT_BYREF;
}
retVal += TypeAsString(vt);
MessageBoxA(0,retVal.c_str(),"",0);
}