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. A bug about MFC [modified]

A bug about MFC [modified]

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

    I create a MFC project,and print a Bitmap on it,but when run it and want to change the size of the Windows,it just can't,it will bugged and show the warning message below,besides when i move the window,it also show the warning message. Bebug Assertion Failed! Program:~~~~~~ file:wingdi.cpp line:~~~ for information on how your program can cause an assertion fail,see the VC++ documentation on asserts. any one can help me!Please. Thanks in advance. modified on Sunday, March 8, 2009 12:44 AM

    H 1 Reply Last reply
    0
    • A Archy_Yu

      I create a MFC project,and print a Bitmap on it,but when run it and want to change the size of the Windows,it just can't,it will bugged and show the warning message below,besides when i move the window,it also show the warning message. Bebug Assertion Failed! Program:~~~~~~ file:wingdi.cpp line:~~~ for information on how your program can cause an assertion fail,see the VC++ documentation on asserts. any one can help me!Please. Thanks in advance. modified on Sunday, March 8, 2009 12:44 AM

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

      Can you show your code that it generates this error?

      Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

      A 1 Reply Last reply
      0
      • H Hamid Taebi

        Can you show your code that it generates this error?

        Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

        A Offline
        A Offline
        Archy_Yu
        wrote on last edited by
        #3

        void CGobangView::OnDraw(CDC* pDC) { CGobangDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); m_chessboard.LoadBitmap(IDB_ChessBoard); //绑定位图 CGobangView::m_begin.LoadBitmap(IDB_Start); CGobangView::m_end.LoadBitmap(IDB_Stop); static int i=0; if(i==0) { CGobangView::Chessboard.CreateCompatibleDC(pDC); Chessboard.SelectObject(m_chessboard); CGobangView::Begin.CreateCompatibleDC(pDC); Begin.SelectObject(m_begin); CGobangView::End.CreateCompatibleDC(pDC); End.SelectObject(m_end); i=1; } else { } pDC->BitBlt(0,0,800,600,&Chessboard,0,0,SRCCOPY); // TODO: add draw code for native data here } The above is the code; i only modify the onDraw() function,and The others is the Generated code by MFC wizard.

        L H 2 Replies Last reply
        0
        • A Archy_Yu

          void CGobangView::OnDraw(CDC* pDC) { CGobangDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); m_chessboard.LoadBitmap(IDB_ChessBoard); //绑定位图 CGobangView::m_begin.LoadBitmap(IDB_Start); CGobangView::m_end.LoadBitmap(IDB_Stop); static int i=0; if(i==0) { CGobangView::Chessboard.CreateCompatibleDC(pDC); Chessboard.SelectObject(m_chessboard); CGobangView::Begin.CreateCompatibleDC(pDC); Begin.SelectObject(m_begin); CGobangView::End.CreateCompatibleDC(pDC); End.SelectObject(m_end); i=1; } else { } pDC->BitBlt(0,0,800,600,&Chessboard,0,0,SRCCOPY); // TODO: add draw code for native data here } The above is the code; i only modify the onDraw() function,and The others is the Generated code by MFC wizard.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          What line in wingdi reports an ASSERT or error? It looks like you have locked something and the window cannot get it for its own drawing.

          1 Reply Last reply
          0
          • A Archy_Yu

            void CGobangView::OnDraw(CDC* pDC) { CGobangDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); m_chessboard.LoadBitmap(IDB_ChessBoard); //绑定位图 CGobangView::m_begin.LoadBitmap(IDB_Start); CGobangView::m_end.LoadBitmap(IDB_Stop); static int i=0; if(i==0) { CGobangView::Chessboard.CreateCompatibleDC(pDC); Chessboard.SelectObject(m_chessboard); CGobangView::Begin.CreateCompatibleDC(pDC); Begin.SelectObject(m_begin); CGobangView::End.CreateCompatibleDC(pDC); End.SelectObject(m_end); i=1; } else { } pDC->BitBlt(0,0,800,600,&Chessboard,0,0,SRCCOPY); // TODO: add draw code for native data here } The above is the code; i only modify the onDraw() function,and The others is the Generated code by MFC wizard.

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

            Did you check values return of CreateCompatibleDC? what was it?

            Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

            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