wglGetCurrentContext

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

HGLRC wglGetCurrentContext(VOID);

Parameters

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.

Remarks

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.

QuickInfo

  Windows NT: Use version 3.5 and later.
  Windows: Use Windows 95 and later.
  Windows CE: Unsupported.
  Header: Declared in wingdi.h.
  Import Library: Link with opengl32.lib.

See Also

OpenGL on Windows NT and Windows 95 Overview, WGL Functions, wglCreateContext, wglDeleteContext, wglGetCurrentDC, wglMakeCurrent