How to convert CString to BSTR?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: How to convert CString to BSTR?

  1. #1
    Join Date
    Aug 2000
    Location
    Ottawa, Canada
    Posts
    469

    How to convert CString to BSTR?


    CString oGiven;
    BSTR bstrOutcome;
    // ...
    bstrOutcome = (BSTR) oGiven; // doesn't work



    Help please.


  2. #2
    Join Date
    Oct 2000
    Location
    India
    Posts
    4,620

    Re: How to convert CString to BSTR?

    Hi,

    Take a look at this code.

    CString oGiven = "abcde" ;
    BSTR bstrOutcome = oGiven.AllocSysString() ;



    [b]Let me know if that helped.
    Visit http://www.geocities.com/contactgirish/homepage.html for some VC++ Links & Notes.If you have time, you can sign the guest book there.
    Regards,
    V.Girish
    All luck and have a great day.

    Regards,
    V.Girish

    Visit www.geocities.com/contactgirish for Source code, Tutorials, FAQs and Downloads.

  3. #3
    Join Date
    Aug 2000
    Location
    Ottawa, Canada
    Posts
    469

    Thank you very much.

    It works!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center