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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Getting Assertion Failure

Getting Assertion Failure

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

    Hi, I have derived my class from CPropertyPage, I have included a Groupbox control. Inside that Groupbox I have included three Edit controls. I mapped CString variables as well as CONTROL variables for those Edit controls. Now when I am going to enable or disable those Edit control based on some values I am getting errors. Anybody have any idea. The Phantom is Tracking Bullets.

    K K 2 Replies Last reply
    0
    • P Ph ntom

      Hi, I have derived my class from CPropertyPage, I have included a Groupbox control. Inside that Groupbox I have included three Edit controls. I mapped CString variables as well as CONTROL variables for those Edit controls. Now when I am going to enable or disable those Edit control based on some values I am getting errors. Anybody have any idea. The Phantom is Tracking Bullets.

      K Offline
      K Offline
      KingsGambit
      wrote on last edited by
      #2

      Instead of using the member for the CONTROL, use GetDlgItem(IDD_EDIT1)->EnableWindow(0) to enable or disable the edit box.

      1 Reply Last reply
      0
      • P Ph ntom

        Hi, I have derived my class from CPropertyPage, I have included a Groupbox control. Inside that Groupbox I have included three Edit controls. I mapped CString variables as well as CONTROL variables for those Edit controls. Now when I am going to enable or disable those Edit control based on some values I am getting errors. Anybody have any idea. The Phantom is Tracking Bullets.

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

        What and where Asserts? X| At first the controls must be created and have a handle than you dan disable them.:suss: First step show the Page with enabled controls, than make a button "disable" with disabling and final change the disabling code to where you want it. Try this @ home. (B&B)

        P 1 Reply Last reply
        0
        • K KarstenK

          What and where Asserts? X| At first the controls must be created and have a handle than you dan disable them.:suss: First step show the Page with enabled controls, than make a button "disable" with disabling and final change the disabling code to where you want it. Try this @ home. (B&B)

          P Offline
          P Offline
          Ph ntom
          wrote on last edited by
          #4

          I have already explained what I am getting. There is still an assertion when I am setting the EditControl->EnableWindow(FALSE) values. Please anybody has any idea how to do this, fist read the entire problem then answer please. Thanks :confused: The Phantom is Tracking Bullets.

          P A 2 Replies Last reply
          0
          • P Ph ntom

            I have already explained what I am getting. There is still an assertion when I am setting the EditControl->EnableWindow(FALSE) values. Please anybody has any idea how to do this, fist read the entire problem then answer please. Thanks :confused: The Phantom is Tracking Bullets.

            P Offline
            P Offline
            Ph ntom
            wrote on last edited by
            #5

            Finally I have got the solution. The answer to this problem is, to add an OnInitDialog(...) for the PropertyPage dervied class. And call the GetDlgItem(...)->EnableWindow(FALSE) in the OnInitDialog(...). Thanks God for saving the day ;P The Phantom is Tracking the Bullets.

            A 1 Reply Last reply
            0
            • P Ph ntom

              I have already explained what I am getting. There is still an assertion when I am setting the EditControl->EnableWindow(FALSE) values. Please anybody has any idea how to do this, fist read the entire problem then answer please. Thanks :confused: The Phantom is Tracking Bullets.

              A Offline
              A Offline
              Alexinuk
              wrote on last edited by
              #6

              busisoft wrote: I have already explained what I am getting. There is still an assertion when I am setting the EditControl->EnableWindow(FALSE) values. It seems like you are missing the point of ASSERTions. When your code ASSERTs it is usually because you are not using the MFC classes in the way in which they are intended. I'm betting that the assertion that caused your code to crash was: ASSERT(m_hWnd != NULL); This line of code causes an Assertion when whichever window has not been created, so just by looking at this line of code in the debugger (when you get an Assertion, run your program in the debugger, then click on "Retry" - the debugger will jump to the Assertion in the MFC source (unless, of course you have your opwn ASSERTions in place - quite a good idea)) you will be able to see what is wrong. Once you've debugged a few of these you will know what each one means and be able to fix the problem in a matter of minutes. -Alex

              1 Reply Last reply
              0
              • P Ph ntom

                Finally I have got the solution. The answer to this problem is, to add an OnInitDialog(...) for the PropertyPage dervied class. And call the GetDlgItem(...)->EnableWindow(FALSE) in the OnInitDialog(...). Thanks God for saving the day ;P The Phantom is Tracking the Bullets.

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

                busisoft wrote: Thanks God for saving the day Not God, Microsoft. Easy mistake to make though;-)

                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