• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 573
  • Last Modified:

Alternative To CComBSTR



I'm basically trying to do this....

i->name = CComBSTR((char *)name);

Without using the CComBSTR method because when I use it with Microsoft Application Verifier it's giving me an error.  So I need another way around it....
0
cophi
Asked:
cophi
  • 2
1 Solution
 
AlexFMCommented:
Try _bstr_t wrapper. Or use SysAllocString API, without any wrappers.
0
 
cophiAuthor Commented:
Ok... Should I be using the Detach or CopyTo functions if I'm passing the i pointer(i->name) into another function.  
0
 
AlexFMCommented:
If another function is supposed to keep BSTR passed to it, use Detach method:

_bstr_t str(name);
OtherFunction(str.Detach());    // now other function is responsible for releasing BSTR
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now