VARIANT and CString
-
I have a function that return variant.How can I cast it to CString? Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down
-
I have a function that return variant.How can I cast it to CString? Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down
VARIANT v; CString strValue; //TCHAR sz[5]; VariantInit(&v); v.vt = VT_BSTR; v.bstrVal = strValue.AllocSysString(); //v.bstrVal = SysAllocString(sz); //do something with variant SysFreeString(v.bstrVal); VariantClear(&v); another way around Variant v; //variant gets value CString strValue(v.bstrVal); hope it helps DanielO
-
VARIANT v; CString strValue; //TCHAR sz[5]; VariantInit(&v); v.vt = VT_BSTR; v.bstrVal = strValue.AllocSysString(); //v.bstrVal = SysAllocString(sz); //do something with variant SysFreeString(v.bstrVal); VariantClear(&v); another way around Variant v; //variant gets value CString strValue(v.bstrVal); hope it helps DanielO
-
VARIANT v; CString strValue; //TCHAR sz[5]; VariantInit(&v); v.vt = VT_BSTR; v.bstrVal = strValue.AllocSysString(); //v.bstrVal = SysAllocString(sz); //do something with variant SysFreeString(v.bstrVal); VariantClear(&v); another way around Variant v; //variant gets value CString strValue(v.bstrVal); hope it helps DanielO
-
use the c_str() method
-
I have a function that return variant.How can I cast it to CString? Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down
CString s( _variant_t(FunctionReturningVariant()) ); Concussus surgo. When struck I rise.