
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