The Windows API function GetDC()
accepts a single parameter:
hWnd
A handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire screen.
Further down the page, the following is noted:
After painting with a common DC, the
ReleaseDC
function must be called to release the DC. Class and private DCs do not have to be released.ReleaseDC
must be called from the same thread that calledGetDC
. The number of DCs is limited only by available memory.
Unfortunately, it is unclear whether calling ReleaseDC()
is necessary for a screen DC since its type is not mentioned anywhere. In fact, this page describes five types of DCs; but none of them mention "screen".
Do I need to call ReleaseDC()
on a screen DC?
A screen DC is not a class DC, and it's not a private DC, so yes - it needs to be released.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With