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. Null reference exception

Null reference exception

Scheduled Pinned Locked Moved C / C++ / MFC
performancehelp
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.
  • K Offline
    K Offline
    K narasimharao
    wrote on last edited by
    #1

    Hi, When I am using _bstr_t variable (member variable) then I am getting Null Reference exception while destorying the class object.In that class,I am assigning different values to _bstr_t member variable. When we are assigning different values to that variable do we need to allocate any memory for that variable explicitly before assigning the values to it. or else how can we solve this problem. Please give to me any suggestions Thanks & regards, Narasimharao

    knarasimharao

    P _ 2 Replies Last reply
    0
    • K K narasimharao

      Hi, When I am using _bstr_t variable (member variable) then I am getting Null Reference exception while destorying the class object.In that class,I am assigning different values to _bstr_t member variable. When we are assigning different values to that variable do we need to allocate any memory for that variable explicitly before assigning the values to it. or else how can we solve this problem. Please give to me any suggestions Thanks & regards, Narasimharao

      knarasimharao

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      Can you show some code ? One possiblility is that, BSTR wrapped under it is freed already.

      Prasad Notifier using ATL

      1 Reply Last reply
      0
      • K K narasimharao

        Hi, When I am using _bstr_t variable (member variable) then I am getting Null Reference exception while destorying the class object.In that class,I am assigning different values to _bstr_t member variable. When we are assigning different values to that variable do we need to allocate any memory for that variable explicitly before assigning the values to it. or else how can we solve this problem. Please give to me any suggestions Thanks & regards, Narasimharao

        knarasimharao

        _ Offline
        _ Offline
        _AnsHUMAN_
        wrote on last edited by
        #3

        Can you post some relevant code.How you are using the variables. Did you try and debug your application?

        Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

        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