DescribePixelFormat

I'd like to point out that the call to DescribePixelFormat is unnecessary. (Unless you want to inspect the selected PIXELFORMATDESCIPTOR).

From the documentation for SetPixelFormat:

"ppfd - [...] The structure has no other effect upon the behavior of the SetPixelFormat function."

In other words: SetPixelFormat doesn't care about the ppfd parameter at all. AFAIK you can even pass a nullptr and it works just fine. (The example in the SetPixelFormat MSDN doc just passes the original PFD that was given to ChoosePixelFormat.)