The GetPixelFormat function obtains the index of the currently selected pixel format of the specified device context.
int GetPixelFormat(
HDC hdc // device context whose currently selected pixel format
// index is sought
);
If the function succeeds, the return value is the currently selected pixel format index of the specified device context. This is a positive, one-based index value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The following code sample shows GetPixelFormat usage:
PIXELFORMATDESCRIPTOR pfd;
HDC hdc;
int iPixelFormat;
// get the current pixel format index
iPixelFormat = GetPixelFormat(hdc);
// obtain a detailed description of that pixel format
DescribePixelFormat(hdc, iPixelFormat,
sizeof(PIXELFORMATDESCRIPTOR), &pfd);
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 gdi32.lib.
OpenGL on Windows NT and Windows 95 Overview, Win32 Functions, ChoosePixelFormat, DescribePixelFormat, SetPixelFormat