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. Exceptions being thrown

Exceptions being thrown

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelpquestion
7 Posts 4 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.
  • W Offline
    W Offline
    Waldermort
    wrote on last edited by
    #1

    I have exceptions being thrown from two locations within my code, both of them are predefined tree view macros. TreeView_GetItemRect() TreeView_GetItem() If I change the first macro to it's SendMessage() equivlent, the exception is no longer thrown, but as for the second macro I just cannot get it working as it should. Has anybody come across this before? Google has been of little help to me.

    Waldermort

    D D K 3 Replies Last reply
    0
    • W Waldermort

      I have exceptions being thrown from two locations within my code, both of them are predefined tree view macros. TreeView_GetItemRect() TreeView_GetItem() If I change the first macro to it's SendMessage() equivlent, the exception is no longer thrown, but as for the second macro I just cannot get it working as it should. Has anybody come across this before? Google has been of little help to me.

      Waldermort

      D Offline
      D Offline
      DevMentor org
      wrote on last edited by
      #2

      Go to your compiler debug setting and turn on, "break on 1st exception" for all exceptions type. Run the program again from the debugger and cause the exception to get thrown. As soon as the exception is thrown, your code will break and you will be able to tell from the call-stack who is throwing the exception! Inspect the code and figure out why this is happening... are you doing something wrong? did you fail to init something? etc, etc. You will need to do some work, hope this helps!

      --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Debug

      W 1 Reply Last reply
      0
      • D DevMentor org

        Go to your compiler debug setting and turn on, "break on 1st exception" for all exceptions type. Run the program again from the debugger and cause the exception to get thrown. As soon as the exception is thrown, your code will break and you will be able to tell from the call-stack who is throwing the exception! Inspect the code and figure out why this is happening... are you doing something wrong? did you fail to init something? etc, etc. You will need to do some work, hope this helps!

        --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Debug

        W Offline
        W Offline
        Waldermort
        wrote on last edited by
        #3

        It was a bug in my own code ( no surprises there ). I wasn't correctly checking the hWndFrom member within the WM_NOTIFY handler which ended up causing the code to do a custom draw on the incorrect window.

        Waldermort

        D 1 Reply Last reply
        0
        • W Waldermort

          I have exceptions being thrown from two locations within my code, both of them are predefined tree view macros. TreeView_GetItemRect() TreeView_GetItem() If I change the first macro to it's SendMessage() equivlent, the exception is no longer thrown, but as for the second macro I just cannot get it working as it should. Has anybody come across this before? Google has been of little help to me.

          Waldermort

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          How are you calling them?


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          W 1 Reply Last reply
          0
          • D David Crow

            How are you calling them?


            "A good athlete is the result of a good and worthy opponent." - David Crow

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            W Offline
            W Offline
            Waldermort
            wrote on last edited by
            #5

            The problem was due to casting the LPNMHDR into a control specific struct without first checking which control sent the message. A novice mistake which I am highly embarassed about :sigh:

            Waldermort

            1 Reply Last reply
            0
            • W Waldermort

              I have exceptions being thrown from two locations within my code, both of them are predefined tree view macros. TreeView_GetItemRect() TreeView_GetItem() If I change the first macro to it's SendMessage() equivlent, the exception is no longer thrown, but as for the second macro I just cannot get it working as it should. Has anybody come across this before? Google has been of little help to me.

              Waldermort

              K Offline
              K Offline
              KarstenK
              wrote on last edited by
              #6

              Thats to little to understand your problem. Most common problem of treeview issue are that the handles or other parameters are invalid. :confused:

              Greetings from Germany

              1 Reply Last reply
              0
              • W Waldermort

                It was a bug in my own code ( no surprises there ). I wasn't correctly checking the hWndFrom member within the WM_NOTIFY handler which ended up causing the code to do a custom draw on the incorrect window.

                Waldermort

                D Offline
                D Offline
                DevMentor org
                wrote on last edited by
                #7

                Always feels good to find the bug :)

                --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Debug

                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