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. Passing a BSTR parameter into a COM method.

Passing a BSTR parameter into a COM method.

Scheduled Pinned Locked Moved C / C++ / MFC
questioncomxmlhelplearning
2 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.
  • A Offline
    A Offline
    abhinarulkar
    wrote on last edited by
    #1

    Hi, I have to pass a BSTR string which is read from a xml file(using simple C-style fopen,fgetws methods) to a COM method. Within the COM method this BSTR string is to be passed further to a method that takes _bstr_t as a parameter. The problem arises when the BSTR string is to be passed further to the method contained within the COM method. The conversion from BSTR to _bstr_t converts only a portion of the string and not the complete string. Since _bstr_t is just a wrapper over BSTR, it must take BSTR and form a object of _bstr_t,but the object is not showing the complete string passed to it. How do I solve this problem?? Thanks and Regards, Abhishek. Learning is a never ending process of Life.

    S 1 Reply Last reply
    0
    • A abhinarulkar

      Hi, I have to pass a BSTR string which is read from a xml file(using simple C-style fopen,fgetws methods) to a COM method. Within the COM method this BSTR string is to be passed further to a method that takes _bstr_t as a parameter. The problem arises when the BSTR string is to be passed further to the method contained within the COM method. The conversion from BSTR to _bstr_t converts only a portion of the string and not the complete string. Since _bstr_t is just a wrapper over BSTR, it must take BSTR and form a object of _bstr_t,but the object is not showing the complete string passed to it. How do I solve this problem?? Thanks and Regards, Abhishek. Learning is a never ending process of Life.

      S Offline
      S Offline
      Stefan Spenz
      wrote on last edited by
      #2

      Try using the BSTR in the _bstr_t's constructor, e.g. _bstr_t stuff(/*BSTR here*/); This should solve your problem When I was young my mother told me to clean up my room, I told her -1!

      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