La afirmación falla con GetDC () (usando mfc)
Frecuentes
Visto 682 veces
0
So, I keep getting an assertion fail:
_AFXWIN_INLINE CDC* CWnd::GetDC()
{ ASSERT(::IsWindow(m_hWnd)); return CDC::FromHandle(::GetDC(m_hWnd)); }
And I checked the call stack and the method called before the method above is:
CDC *pDC = GetDC();
I'm not sure what is wrong with any of this, but I would like some help. Thanks!
1 Respuestas
1
If you get this Assertion you use the CWNd::GetDC function without having a created window. Or the window is already destroyed.
respondido 27 nov., 13:07
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas c++ mfc or haz tu propia pregunta.
Can you post a little more context? Looks like
m_hWnd
is bad but without seeing how it was created and such it's just a guess. - Retired Ninjaits been a while but if I remember correctly, if you are getting the DC in OnPaint you need to create a CPaintDC. But more context is needed on when you are calling GetDC - Serve Laurijssen
@Servé
CPaintDC
is a convenience, not a necessity. No application is ever required to instantiate aCPaintDC
. - IInspectable