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. COM
  4. BSTR variable

BSTR variable

Scheduled Pinned Locked Moved COM
helpquestion
3 Posts 3 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.
  • V Offline
    V Offline
    vc _fragrance
    wrote on last edited by
    #1

    Hi Can you please tell me...what is the wrong in the following code snippet . BSTR abc; abc is having some data in it. Now I need to check whether abc is having empty string. for that I wrote the code like this if( abc ==L"") AfxMessageBox("empty string"); But I receive a compilation error ; Please help me to ressolve the issue. Thanks in advance.

    L CPalliniC 2 Replies Last reply
    0
    • V vc _fragrance

      Hi Can you please tell me...what is the wrong in the following code snippet . BSTR abc; abc is having some data in it. Now I need to check whether abc is having empty string. for that I wrote the code like this if( abc ==L"") AfxMessageBox("empty string"); But I receive a compilation error ; Please help me to ressolve the issue. Thanks in advance.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Use SysStringLen[^] for BSTR BSTR is not a class. If you wish to use == for comparing two BSTRs then use _bstr_t class which wraps BSTR data type

      Sohail

      1 Reply Last reply
      0
      • V vc _fragrance

        Hi Can you please tell me...what is the wrong in the following code snippet . BSTR abc; abc is having some data in it. Now I need to check whether abc is having empty string. for that I wrote the code like this if( abc ==L"") AfxMessageBox("empty string"); But I receive a compilation error ; Please help me to ressolve the issue. Thanks in advance.

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        you may use

        if ( wcscmp(abc,L"") == 0)
        AfxMessageBox("empty string");

        or, if you want to use the equality operator, choose to encapsulate the BSTR data inside a _bstr_t object. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

        In testa che avete, signor di Ceprano?

        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