Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All


The wglGetCurrentContext function obtains a handle to the current OpenGL rendering context of the calling thread.

HGLRC wglGetCurrentContext(VOID);


This function has no parameters.

Return Values

If the calling thread has a current OpenGL rendering context, wglGetCurrentContext returns a handle to that rendering context. Otherwise, the return value is NULL.


The current OpenGL rendering context of a thread is associated with a device context by means of the wglMakeCurrent function. You can use the wglGetCurrentDC function to obtain a handle to the device context associated with the current OpenGL rendering context.


  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in wingdi.h.
  Import Library: Use opengl32.lib.

See Also

OpenGL on Windows NT, Windows 2000, and Windows 95/98, WGL Functions, wglCreateContext, wglDeleteContext, wglGetCurrentDC, wglMakeCurrent


Community Additions

© 2015 Microsoft