To close a device context that your application opened with DevOpenDC, call DevCloseDC. However, you should not try to close a device context that you opened with WinOpenWindowDC. The operating system does this automatically when the associated window is deleted.