| Previous | Next |
| ERROR_INVALID_EDIT_HEIGHT | ERROR_INVALID_HOOK_FILTER |
ERROR_DC_NOT_FOUND
The device-context handle is invalid
A display device context is an opaque GDI drawing state obtained through paths such as BeginPaint, GetDC, GetDCEx, or GetWindowDC. Its lifetime and release API depend on how it was obtained.
A frequent cause is keeping a common/window DC after ReleaseDC, using a paint DC after EndPaint, or confusing an HDC with another GDI handle. ReleaseDC must also be paired with GetDC/GetWindowDC and called from the same thread for common/window DCs.
What to check
- Track the acquisition API next to the
HDC. - Pair
BeginPaintwithEndPaintandGetDCwithReleaseDC. - Do not cache common DCs beyond their documented use.
- Log thread identity if the handle crosses worker/UI thread boundaries.
Drawing failures with a valid DC may involve selected GDI objects or clipping; this code says the DC handle itself cannot be resolved.
References
Looking for a different code? Search another status or error code.