HWND hwnd, // handle of window
HDC hdc // handle of device context );
DECLAREINTEGER ReleaseDC IN user32;
Identifies the window whose device context is to be released
Identifies the device context to be released
The return value specifies whether the device context is released. If the device context is released, the return value is 1
Once you obtain a device context (retrieved by GetDC, or GetWindowDC functions), you may write to the window. At the end of this process the device context must be released using ReleaseDC. Otherwise you will have a memory leak.
GDI Black Book: remember, use the ReleaseDC function only for a display device context that was retrieved from the GDI device-context cache. After you"re done with the memory device context, you must free it by using the DeleteDC function.
- use ReleaseDC for forms (the hwnd used as the first parameter)
- use DeleteDC for memory device contexts (e.g. CreateCompatibleDC function)