Solved

Getting amount of available screencolors

Posted on 1997-09-28
2
170 Views
Last Modified: 2010-04-04
Hi,

How do I find out how many colors are available on the screen (16, 256, 16M etc.) ? I need this for an application that uses 256 color bitmaps and I don't want the program to start when less than 256 colors are available.

Michael.
0
Comment
Question by:michaelsanders
2 Comments
 
LVL 1

Accepted Solution

by:
fsanchez earned 50 total points
ID: 1346381
There are two possibilities, both using this function:

function GetDeviceCaps(
  HDC hdc,  { device-context handle }
  int nIndex { index of capability to query }
  ): Integer;

For the first parameter we can use MyForm.Canvas.Handle
For the second parameter there the following two possibilities:
1.- BITSPIXEL -> The function will return 4 for 16 colors palette, 8 for 256 colors palette, 16 for 65536 colors, 24 for 16M.
2.- NUMCOLORS -> The number of colors

For your problem I'll use:
  if GetDeviceCaps(MyForm.Canvas.Handle, BITSPIXEL) < 8
  then { Don't start }
  else { OK, start }

Good luck ;-)
0
 
LVL 1

Author Comment

by:michaelsanders
ID: 1346382
Great, Thanks !
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 287
Activex loadlibrary and show parented form issue 6 286
Delphi Form ownership 4 73
Press three keys together and trigger a function 3 51
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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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