Get color depth (bits)

Posted in System info

Use GetDeviceCaps function with BITSPIXEL parameter. This function returns number of adjacent color bits for each pixel.

procedure TForm1.Button1Click(Sender: TObject);
var
  TempDC: HDC;
  i: Integer;
begin
  TempDC:=GetDC(GetDesktopWindow);
  i:=GetDeviceCaps(TempDC, BITSPIXEL);
  Label1.Caption:='Color schema '+IntToStr(i)+' bits';
end;