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