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. Error in Create Dialog

Error in Create Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++question
15 Posts 6 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.
  • N Nelek

    m_DlgClr is a CBrush?

    Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson Rating helpfull answers is nice, but saying thanks can be even nicer.

    S Offline
    S Offline
    Shivarudrayya H
    wrote on last edited by
    #6

    Ya..

    Reagards Shiva

    M 1 Reply Last reply
    0
    • S SandipG

      Where is it crashing ?? In OnCtlColor() dont call base class version always call only in else part.

      S Offline
      S Offline
      Shivarudrayya H
      wrote on last edited by
      #7

      I traced it.Its crashing in following code. BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd, HINSTANCE hInst) { ASSERT(lpDialogTemplate != NULL); if (pParentWnd != NULL) ASSERT_VALID(pParentWnd); . . . . . hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate, (CRASH)-----> pParentWnd->GetSafeHwnd(), AfxDlgProc);

      Reagards Shiva

      1 Reply Last reply
      0
      • S Shivarudrayya H

        Ya..

        Reagards Shiva

        M Offline
        M Offline
        MANISH RASTOGI
        wrote on last edited by
        #8

        Try create brush in constructor instead of OnInitDialog.

        S 1 Reply Last reply
        0
        • M MANISH RASTOGI

          Try create brush in constructor instead of OnInitDialog.

          S Offline
          S Offline
          Shivarudrayya H
          wrote on last edited by
          #9

          I tried it.It wont paint the dialog.

          Reagards Shiva

          1 Reply Last reply
          0
          • S Shivarudrayya H

            m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog(). and in OnCtlColor(,,) HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(nCtlColor == CTLCOLOR_DLG) return m_DlgClr; return hbr;

            Reagards Shiva

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

            Shivarudrayya H wrote:

            I am creating it in OnInitDialog().

            What does this method look like?

            "Love people and use things, not love things and use people." - Unknown

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

            1 Reply Last reply
            0
            • S Shivarudrayya H

              m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog(). and in OnCtlColor(,,) HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(nCtlColor == CTLCOLOR_DLG) return m_DlgClr; return hbr;

              Reagards Shiva

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #11

              Did you write this line on the OnInitDialog? m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog().

              S 1 Reply Last reply
              0
              • H Hamid Taebi

                Did you write this line on the OnInitDialog? m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog().

                S Offline
                S Offline
                Shivarudrayya H
                wrote on last edited by
                #12

                ya..

                Reagards Shiva

                H 1 Reply Last reply
                0
                • S Shivarudrayya H

                  ya..

                  Reagards Shiva

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #13

                  Why you dont insert it on the constructor of your project?

                  S 1 Reply Last reply
                  0
                  • H Hamid Taebi

                    Why you dont insert it on the constructor of your project?

                    S Offline
                    S Offline
                    Shivarudrayya H
                    wrote on last edited by
                    #14

                    As i said earlier it wont paint the dialog.

                    Reagards Shiva

                    H 1 Reply Last reply
                    0
                    • S Shivarudrayya H

                      As i said earlier it wont paint the dialog.

                      Reagards Shiva

                      H Offline
                      H Offline
                      Hamid Taebi
                      wrote on last edited by
                      #15

                      I guess your problem is of Onctlcolor.

                      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