native-com-support

Is there a faster way of getting a char* from a _variant_t than (const char*)(_bstr_t)

Here's the code I want to speed up. It's getting a value from an ADO recordset and converting it to a char*. But this is slow. Can I skip the creation of the _bstr_t? _variant_t var = pRs->Fields->GetItem(i)->GetValue(); if (V_VT(&var) == VT_BSTR) { char* p = (c...

Copying between VARIANT and _variant_t

I'm fairly certain that I can safely do: void funcA(VARIANT &V,_variant_t &vt) { vt = V; } But what about the other way around: void funcB(VARIANT &V,_variant_t &vt) { V = vt; } I've been seeing some REALLY weird behaviour in my app which I put down to COM-related threading issues. But then I got wondering if I was screwing...