Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CComBSTR to string

CComBSTR to string

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pocketpool
    wrote on last edited by
    #1

    Hi, I'm having a terrible time just trying to convert a CComBSTR to a string not char *, but string from . Can anyone help? Or how about VARIANT to string - but I think its the same problem because it seems that I have to use the bstrval property of a VARIANT.

    J 1 Reply Last reply
    0
    • P pocketpool

      Hi, I'm having a terrible time just trying to convert a CComBSTR to a string not char *, but string from . Can anyone help? Or how about VARIANT to string - but I think its the same problem because it seems that I have to use the bstrval property of a VARIANT.

      J Offline
      J Offline
      Jaime Stuardo
      wrote on last edited by
      #2

      You can use OLE2A macro, for example, USES_CONVERSION; CComBSTR bstrSource = "Text to convert"; std::string sTarget = OLE2A(bstrSource); Jaime

      P 1 Reply Last reply
      0
      • J Jaime Stuardo

        You can use OLE2A macro, for example, USES_CONVERSION; CComBSTR bstrSource = "Text to convert"; std::string sTarget = OLE2A(bstrSource); Jaime

        P Offline
        P Offline
        pocketpool
        wrote on last edited by
        #3

        Thank you very much - that has made the next 2 crappy days 4 me better:)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups