hglrc
Handle to an OpenGL rendering context that the function sets as the calling thread's rendering context.
If hglrc is NULL, the function makes the calling thread's current rendering context no longer current, and releases the device context that is used by the rendering context. In this case, hdc is ignored.

So, I thought that wglMakeCurrent(NULL, NULL) calls ReleaseDC() inner code of it. Although it's not ReleaseDC(), Device Context will be released, I think.
However, almost sample codes on online call ReleaseDC() after wglMakeCurrent(NULL, NULL). Even NeHe's sample code is also, too.

So, I thought that wglMakeCurrent(NULL, NULL) calls ReleaseDC() inner code of it. Although it's not ReleaseDC(), Device Context will be released, I think.
However, almost sample codes on online call ReleaseDC() after wglMakeCurrent(NULL, NULL). Even NeHe's sample code is also, too.

I think you are reading too much into the description. The webpage states that the rendering context "releases the device contextthat is used by the rendering context". In other words, the rendering context is no longer coupled to that particular device context. Of course, I think it may still be a good idea to run a test under the debugger to see whether you end up with a resource leak if you don't call ReleaseDC() before assuming that it's not necessary.

I think you are reading too much into the description. The webpage states that the rendering context "releases the device contextthat is used by the rendering context". In other words, the rendering context is no longer coupled to that particular device context. Of course, I think it may still be a good idea to run a test under the debugger to see whether you end up with a resource leak if you don't call ReleaseDC() before assuming that it's not necessary.

Thank you for your answer.
As your opinion, I want to run a test if it is memory leak or not. However, I don't know the test way. If you don't mind, can you tell me the way?
_CrtDumpMemoryLeaks(); function can't do it.

Thank you for your answer.
As your opinion, I want to run a test if it is memory leak or not. However, I don't know the test way. If you don't mind, can you tell me the way?
_CrtDumpMemoryLeaks(); function can't do it.

If you call ReleaseDC() and then try to use the invalid handle, the program will crash and the debugger will generally notify you that there was an invalid operation. Presumably if you are correct in your assumption, calling wglMakeCurrent(nullptr, nullptr) will result in similar program behavior.

If you call ReleaseDC() and then try to use the invalid handle, the program will crash and the debugger will generally notify you that there was an invalid operation. Presumably if you are correct in your assumption, calling wglMakeCurrent(nullptr, nullptr) will result in similar program behavior.

Oh, Thank you very much.
I tried to run a test, and resulted that my assumption is false. If it doesn't call ReleaseDC() after calling wglMakeCurrent(NULL, NULL), the DC handle is still valid. So, though wglMakeCurrent(NULL, NULL) will be called, I have to call ReleaseDC(). Thanks.