Board index » delphi » Pixelformat(color depth) of desktop

Pixelformat(color depth) of desktop

[Delphi 2] I want to know the pixelformat of the desktop (color depth
8/16/24-bit) in order to load gfx with optimized palettes or gfx
dithered to the standard palette. Sort of TScreen.PixelFormat but that
doesn't exist. I found in Win32 API the function
int GetPixelFormat(HDC hdc);
but then I need to know the (i think device context/gfx handle)
Please help...

Re:Pixelformat(color depth) of desktop

I found out already, thanks to Paul Harding
This is it:

function GetColorDepth: Integer;
  DC: HDC;
  Index: Integer;
  Index := BITSPIXEL; // See Win32.hlp GetDeviceCaps
  DC := GetDC(0); {0 = screen}
  Result := GetDeviceCaps(DC, Index);
  ReleaseDC(0, DC);

Other Threads