1 2 unit Unit1; 3 4 interface 5 6 uses 7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 8 Dialogs, StdCtrls; 9 10 type 11 TForm1 = class(TForm) 12 Button1: TButton; 13 procedure Button1Click(Sender: TObject); 14 private 15 { Private declarations } 16 public 17 { Public declarations } 18 end; 19 20 var 21 Form1: TForm1; 22 23 implementation 24 25 {$R *.dfm} 26 27 function GetColorsCount : Int64; 28 var 29 h : hDC; 30 bitsperpixel:Int64; 31 begin 32 Result := 0; 33 bitsperpixel := 0; 34 try 35 h := GetDC(0); 36 bitsperpixel := GetDeviceCaps(h, PLANES) * 37 GetDeviceCaps(h, BITSPIXEL); 38 Result := 1 shl bitsperpixel; 39 finally 40 ReleaseDC(0, h); 41 end; 42 end; 43 44 45 procedure TForm1.Button1Click(Sender: TObject); 46 var 47 i:integer; 48 begin 49 showmessage('Colors:'+intToStr(GetColorsCount)); 50 end; 51 52 end.