Determine system color depth? 
Author Message
 Determine system color depth?

How do I determine the color depth of the system in VB?
-Thanks,

adrian



Sat, 01 Sep 2001 03:00:00 GMT  
 Determine system color depth?
This is what you call FAQ..

The ColorDepth function returns the color depth as a bits per pixel number,
for example on a true-color display the function will return 24. The
function obtains a screen dc because the GetDeviceCaps function needs a dc
for input.

Private Const PLANES& = 14
Private Const BITSPIXEL& = 12
Private Declare Function GetDeviceCaps& Lib "gdi32" (ByVal hdc As Long,
ByVal nIndex As Long)
Private Declare Function GetDC& Lib "user32" (ByVal hwnd As Long)
Private Declare Function ReleaseDC& Lib "user32" (ByVal hwnd As Long, ByVal
hdc As Long)

Private Function ColorDepth() As Integer
  Dim nPlanes As Integer, BitsPerPixel As Integer, dc As Long
  dc = GetDC(0)
  nPlanes = GetDeviceCaps(dc, PLANES)
  BitsPerPixel = GetDeviceCaps(dc, BITSPIXEL)
  ReleaseDC 0, dc
  ColorDepth = nPlanes * BitsPerPixel
End Function

Niels Hede Pedersen
MCP

Quote:

>How do I determine the color depth of the system in VB?
>-Thanks,

>adrian



Sat, 01 Sep 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Determine color depth

2. How do I determine the display color depth?

3. How to Determine Color Depth?

4. Determining Color Pallette Depth

5. Determining color depth?

6. How to Determine Color Depth?

7. Determining Color Pallette Depth

8. Determining color depth?

9. How to Determine Color Depth?

10. Determining Color Pallette Depth

11. determining display color depth in VB4?

12. How to Determine Color Depth?

 

 
Powered by phpBB® Forum Software