Solved

How to retrieve color depth

Posted on 1998-11-25
5
282 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
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
try his to get the color depth ( 8 bit.. 16 bit.. 24 bit.. )

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

bryan
0
 

Author Comment

by:Tulip
Comment Utility
Thanks, Bryan. This works even better !!
0
 
LVL 3

Expert Comment

by:bryan7
Comment Utility
glad to help,

bryan =)

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Send message from delphi to whatsapp, is it possible? 3 912
code issue 8 84
Delphi - replicating a form 8 57
find a node in VST 2 46
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now