When using these for a screencap, you can use the shortcut GetDC(0) or GetWindowDC(0), instead of first calling GetDesktopWinow and then passing the hWnd returned from that to GetDC or GetWindowDC. It even says so in the official MS documents at:
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
and
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
But this leaves me with a question. When you are done using a DC, you normally have to release control of that DC back to its original window's hWnd using ReleaseDC(hWnd,hDC). But in this case, we skipped the step of using GetDesktopWindow, and instead used the number 0 (zero) in the input of GetDC or GetWindowDC. Therefore there's no way to know the hWnd that is needed to release it back to. And I don't think that the literal number 0 is a valid value for the hWnd parameter of the ReleaseDC function. Any idea what to do here?
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
and
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
But this leaves me with a question. When you are done using a DC, you normally have to release control of that DC back to its original window's hWnd using ReleaseDC(hWnd,hDC). But in this case, we skipped the step of using GetDesktopWindow, and instead used the number 0 (zero) in the input of GetDC or GetWindowDC. Therefore there's no way to know the hWnd that is needed to release it back to. And I don't think that the literal number 0 is a valid value for the hWnd parameter of the ReleaseDC function. Any idea what to do here?