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. Debug Assertion?

Debug Assertion?

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelpquestion
9 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.
  • A Offline
    A Offline
    Aoife
    wrote on last edited by
    #1

    Hello, In my MFC application I have two similar dialog boxes. Each have a List Control Box and each has a varaible (of type CListCtrl) associated to them. One of them works fine but I get a Debug Assertion error on the first of these four lines in the second dialog. m_MyListControl2.InsertItem(0, Line1, 0) m_MyListControl2.SetItemText(0, 1, Line2); m_MyListControl2.SetItemText(0, 2, Line3); m_MyListControl2.SetItemText(0, 3, Line5); The dialog boxes all have the same header files and the contents of DoDataExchange() are similar too. Does anyone know why this is happening? Thanks, Aoife

    M T 2 Replies Last reply
    0
    • A Aoife

      Hello, In my MFC application I have two similar dialog boxes. Each have a List Control Box and each has a varaible (of type CListCtrl) associated to them. One of them works fine but I get a Debug Assertion error on the first of these four lines in the second dialog. m_MyListControl2.InsertItem(0, Line1, 0) m_MyListControl2.SetItemText(0, 1, Line2); m_MyListControl2.SetItemText(0, 2, Line3); m_MyListControl2.SetItemText(0, 3, Line5); The dialog boxes all have the same header files and the contents of DoDataExchange() are similar too. Does anyone know why this is happening? Thanks, Aoife

      M Offline
      M Offline
      mystro_AKA_kokie
      wrote on last edited by
      #2

      if you didn't make those calls in OnInitDialog then it's because they haven't been created yet.

      A 1 Reply Last reply
      0
      • A Aoife

        Hello, In my MFC application I have two similar dialog boxes. Each have a List Control Box and each has a varaible (of type CListCtrl) associated to them. One of them works fine but I get a Debug Assertion error on the first of these four lines in the second dialog. m_MyListControl2.InsertItem(0, Line1, 0) m_MyListControl2.SetItemText(0, 1, Line2); m_MyListControl2.SetItemText(0, 2, Line3); m_MyListControl2.SetItemText(0, 3, Line5); The dialog boxes all have the same header files and the contents of DoDataExchange() are similar too. Does anyone know why this is happening? Thanks, Aoife

        T Offline
        T Offline
        Tim Smith
        wrote on last edited by
        #3

        What does the debug assertion say. Not only does it usually print text about why it asserted, but if you look at the source code where the assert was raise, it sometimes gives you information about what you need to do to correct the problem. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

        A 1 Reply Last reply
        0
        • M mystro_AKA_kokie

          if you didn't make those calls in OnInitDialog then it's because they haven't been created yet.

          A Offline
          A Offline
          Aoife
          wrote on last edited by
          #4

          But the first dialog box isn't mentioned in OnInitDialog and it works fine. Could it be because there is two of them? Thanks,

          1 Reply Last reply
          0
          • T Tim Smith

            What does the debug assertion say. Not only does it usually print text about why it asserted, but if you look at the source code where the assert was raise, it sometimes gives you information about what you need to do to correct the problem. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

            A Offline
            A Offline
            Aoife
            wrote on last edited by
            #5

            It says that the "Debug Assertion Failed" in file winctrl.cpp at line 547. void CListCtrl::DrawItem(LPDRAWITEMSTRUCT) { ASSERT(FALSE); } This is a MFC\src file. It gives no other reason as to why its happening. Thanks

            T 1 Reply Last reply
            0
            • A Aoife

              It says that the "Debug Assertion Failed" in file winctrl.cpp at line 547. void CListCtrl::DrawItem(LPDRAWITEMSTRUCT) { ASSERT(FALSE); } This is a MFC\src file. It gives no other reason as to why its happening. Thanks

              T Offline
              T Offline
              Tim Smith
              wrote on last edited by
              #6

              Then it looks like your list control is marked as owner drawn but you aren't handling the DrawItem routine to draw it. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

              A 1 Reply Last reply
              0
              • T Tim Smith

                Then it looks like your list control is marked as owner drawn but you aren't handling the DrawItem routine to draw it. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

                A Offline
                A Offline
                Aoife
                wrote on last edited by
                #7

                I'm a newbie, so could you please explain how I can fix this? Thanks, Aoife

                C 1 Reply Last reply
                0
                • A Aoife

                  I'm a newbie, so could you please explain how I can fix this? Thanks, Aoife

                  C Offline
                  C Offline
                  Chris Losinger
                  wrote on last edited by
                  #8

                  in the resource editor, open your dialog, double click the listbox then find and un-check the box that says "Owner Drawn" . -c


                  I don't care, and you can't make me.

                  Smaller Animals Software

                  A 1 Reply Last reply
                  0
                  • C Chris Losinger

                    in the resource editor, open your dialog, double click the listbox then find and un-check the box that says "Owner Drawn" . -c


                    I don't care, and you can't make me.

                    Smaller Animals Software

                    A Offline
                    A Offline
                    Aoife
                    wrote on last edited by
                    #9

                    Worked perfectly! I feel a bit thick that I didn't know that, but I'm so happy that I have finally got my application working that I don't care! Thanks a million Chris. Aoife

                    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