Mega Code Archive

 
Categories / Delphi / Graphic
 

Getting video bits per pixel (4=16 colors, 8=256...) (for beginners)

Title: Getting video bits per pixel (4=16 colors, 8=256...) (for beginners) Question: With this code you can get how many bits per pixel your video card is showing... Answer: // returns bits-per-pixel of the current video adapter function DeviceBitsPerPixel: integer; var DC: HDC; begin // gets the DC (device context) of desktop DC := GetDC(0); try // sets the result with bits-per-pixel Result := GetDeviceCaps(DC, PLANES) * GetDeviceCaps(DC, BITSPIXEL); finally // release the DC ReleaseDC(0, DC); end; end;