GetPixelFormat
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
);
Parameters
- hdc
Specifies the device context of the currently selected pixel format index returned by the function.
Return Values
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.
Remarks
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);
Requirements
** 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 gdi32.lib.
See Also
OpenGL on Windows NT, Windows 2000, and Windows 95/98, Win32 Functions, ChoosePixelFormat, DescribePixelFormat, SetPixelFormat