Board index » delphi » determining current windows color depth?

determining current windows color depth?

hi there,

in my application, i'd like to load various image files, depending on
what windows' current color depth is.  is there an easy way to determine
this? i was told in #delphi on EFnet to use an API call, but that began
to lose me.

could someone help me?

thank you,
marc reichman

  vcard.vcf
< 1K Download
 

Re:determining current windows color depth?


hi there,

in my application, i'd like to load various image files, depending on
what windows' current color depth is.  is there an easy way to determine
this? i was told in #delphi on EFnet to use an API call, but that began
to lose me.

could someone help me?

thank you,
marc reichman

  vcard.vcf
< 1K Download

  vcard.vcf
< 1K Download

Re:determining current windows color depth?


You can find the color depth of a display context in the following
manner:

GetDeviceCaps(Form1.Canvas.Handle, BITSPIXEL) *
GetDeviceCaps(Form1.Canvas.Handle, PLANES)

Will give you the total number of bits used to color a pixel. Return
values of:
1 = 2 colors
4 = 16 colors
8 = 256 colors
15 = 32768 colors (will return 16 on most drivers)
16 = 65535 colors
24 = 16,777,216 colors
32 = 16,777,216 colors (same as 24)

You can use (1 shl Value_Returned) to calculate
the total number of colors.

you find this info in the registry:
HKEY_CURRENT_CONFIG\Display\Settings\BitsPerPixel

Hope that helps,

Rkr

Quote
Marc Reichman wrote:

> hi there,

> in my application, i'd like to load various image files, depending on
> what windows' current color depth is.  is there an easy way to determine
> this? i was told in #delphi on EFnet to use an API call, but that began
> to lose me.

> could someone help me?

> thank you,
> marc reichman

--
                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman                              .
. Delphi Programmer / Analyst             .
. TVisualBasic:=class(None);              .
. May the Source be With You              .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A                        .
. E-Mail : rkroman (at) pacbell (dot) net .
. or reidr (at) autobytel (dot) com       .
-------------------------------------------

Other Threads