CodeDoctorJL
CodeDoctorJL

Reputation: 1284

Assertion fail with GetDC() (using mfc)

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!

Upvotes: 0

Views: 777

Answers (1)

xMRi
xMRi

Reputation: 15375

If you get this Assertion you use the CWNd::GetDC function without having a created window. Or the window is already destroyed.

Upvotes: 1

Related Questions