Best way to send string into, and receive string back from COM function

I am writing a COM function that will take a string in and return a modified string back. This COM code is written in C++ and will only be used in a C++ environment, meaning is does not need to be used by any other language (VB). My question is, what is the best (easiest to handle) string type to use for this? LPSTR? BSTR? The output string might copy the input string, and then append another string to the output.
Brian DumasSenior Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

COM generally uses BSTRs, so it's IMO 'best practices' to use them as well, simply because you will need that string type for interacting with COM helper or initialization functions or other components anyway. '_bstr_t' ( is a great wrapper to make your life easier, and this helper class is almost as versatile as STL strings. But even if you use it just for the conversion from/to BSTRs, they come in handy. BTW, see also ("Guide to BSTR and C String Conversions")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Karrtik IyerSoftware ArchitectCommented:
If you are developing on Windows 8 or using winrt (windows SDK 8.1) or visual studio 2013 or above, I suggest you use HSTRING.
If you need further help on the same please let me know.
Karrtik IyerSoftware ArchitectCommented:
Please refer links below that might help you better understand HSTRING :
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.