GetPixelFormat

GetPixelFormat function

The GetPixelFormat function obtains the index of the currently selected pixel format of the specified device context.

Syntax


int WINAPI GetPixelFormat(
   HDC hdc
);

Parameters

hdc

Specifies the device context of the currently selected pixel format index returned by the function.

Return value

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.

Examples

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

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h

Library

Gdi32.lib

DLL

Gdi32.dll

See also

OpenGL on Windows
Windows Functions
ChoosePixelFormat
DescribePixelFormat
SetPixelFormat

 

 

Community Additions

ADD
Show:
© 2016 Microsoft