Solved

How to retrieve color depth

Posted on 1998-11-25
5
290 Views
Last Modified: 2010-04-04
Resolution is no problem using Screen.Width and Height.
But what about the colors ??
0
Comment
Question by:Tulip
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 100 total points
ID: 1347848
If you mean the number of colors in the color palette:
function GetScreenColors: Integer;
var h : hDC;
begin
    Result := 0;
    try
      h := GetDC( 0 );
      Result := 1 shl  (GetDeviceCaps(h, PLANES) * GetDeviceCaps(h, BITSPIXEL));
    finally
      ReleaseDC( 0, h );
    end;
end;
0
 

Author Comment

by:Tulip
ID: 1347849
Hey, a very quick answer !!
your function solves my problem (256 colors or more ?), but it returns 1 if true color is set.
65536 is returned correctly.
This also happens if I change the return type from integer to longint

0
 
LVL 3

Expert Comment

by:bryan7
ID: 1347850
try his to get the color depth ( 8 bit.. 16 bit.. 24 bit.. )

BitsPerPixel := GetDeviceCaps( GetDC( 0 ), BITSPIXEL );

bryan
0
 

Author Comment

by:Tulip
ID: 1347851
Thanks, Bryan. This works even better !!
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1347852
glad to help,

bryan =)

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month11 days, 9 hours left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question