Examen d’un format de pixel actuel de contextes de périphérique

Utilisez les fonctions GetPixelFormat et DescribePixelFormat pour examiner le format de pixel actuel d’un contexte de périphérique, comme indiqué dans le fragment de code suivant.

PIXELFORMATDESCRIPTOR  pfd;
HDC    hdc;
int    iPixelFormat;
 
// if the device context has a current pixel format ...  
if (iPixelFormat = GetPixelFormat(hdc)) { 
 
    // obtain a detailed description of that pixel format  
    DescribePixelFormat(hdc, iPixelFormat, 
                             sizeof(PIXELFORMATDESCRIPTOR), &pfd); 
    }