Solved

Alternative To CComBSTR

Posted on 2006-06-26
3
554 Views
Last Modified: 2008-02-01


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
Comment
Question by:cophi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 16987186
Try _bstr_t wrapper. Or use SysAllocString API, without any wrappers.
0
 

Author Comment

by:cophi
ID: 16991873
Ok... Should I be using the Detach or CopyTo functions if I'm passing the i pointer(i->name) into another function.  
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 16991915
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question