Attribute VB_Name = "ColorDepth"
Private Const BITSPIXEL = 12

Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long

Public Function GetColorDepth() As Long

 Dim DeskHwnd As Long
 Dim DeskDC As Long
 
 DeskHwnd = GetDesktopWindow
 DeskDC = GetWindowDC(DeskHwnd)
 GetColorDepth = GetDeviceCaps(DeskDC, BITSPIXEL)
 
End Function

