Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get color depth

Status
Not open for further replies.

Stefan5627

Programmer
Jul 23, 2002
71
NL
How can i get the colordepth of a system (32-bit, 24-bit, 16-bit or even only 256 colors)
I've looked in sysmetric and sys functions but couldn't find it

can anyone help me?

tia,

Stefan

 
Stefan5627

Code:
LOCAL liGetDC, liDCHandle, liPlanes, liBitsPixel, liNumColors, ;
  liStandardPlanes, liStandardBitsPixel, piDCHandle, piNumColors
DECLARE INTEGER GetDC IN WIN32API INTEGER liGetDC
liDCHandle = GetDC(0)
liStandardPlanes = 14
liStandardBitsPixel= 12
DECLARE INTEGER GetDeviceCaps IN WIN32API ;
  INTEGER piDCHandle, INTEGER piNumColors
liPlanes = GetDeviceCaps(liDCHandle, liStandardPlanes)
liBitsPixel = GetDeviceCaps(liDCHandle, liStandardBitsPixel)
liNumColors = 2^(liPlanes * liBitsPixel)
DECLARE INTEGER ReleaseDC IN WIN32API ;
  INTEGER piHandle, INTEGER piDCHandle
ReleaseDC(0, liDCHandle)
messagebox(TRANSFORM(liNumColors)+ " number of colors")

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top