Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / August 2006

Tip: Looking for answers? Try searching our database.

quick BSTR question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lucy Ludmiller - 30 Aug 2006 08:17 GMT
How can I write a function like this:

BSTR Greeting(BSTR name)
{
    //return "Good Morning : " +  name ;
}

In short I'm looking for a quick tutorial on using BSTR - Google is not
bringing up anything consise enough (I'm not particularly interested in
the history of BSTR and the differences between string types etc ...
just need to get down to the "nuts and bolts" of using BSTRs)
Bruno van Dooren [MVP VC++] - 30 Aug 2006 14:21 GMT
> How can I write a function like this:
>
[quoted text clipped - 7 lines]
> the history of BSTR and the differences between string types etc ...
> just need to get down to the "nuts and bolts" of using BSTRs)

You can use SysAllocString to allocate BSTRs
You have to use SysFreeString to deallocate them afterwards.

If you google around for tutorials that mention SysAllocString, you should
find a number of articles that tell you how to use BSTRs

Signature

Kind regards,
   Bruno.
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"

Ray - 30 Aug 2006 15:37 GMT
> How can I write a function like this:
>
[quoted text clipped - 7 lines]
> the history of BSTR and the differences between string types etc ...
> just need to get down to the "nuts and bolts" of using BSTRs)

Well the thing is that it's easier for you to understand BSTR if you
understand the "differences between string types etc."

But search for _bstr_t, it makes using BSTR *that* much easier. Of
course this being C++ you can't expect it to be as simple as VB, but
close enough :)

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.