|
windows: Возвращение глубины цвета |
|
|
Функция возвращает глубину цвета - 8, 16, 24 или 32 Private Const PLANES& = 14
Private Const BITSPIXEL& = 12
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal
nIndex As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc
As Long) As Long
Public Function ColorDepth() As Integer
Dim intPlanes As Integer
Dim intBitsPerPixel As Integer
Dim lngDC As Long
lngDC = GetDC(0)
intPlanes = GetDeviceCaps(lngDC, PLANES)
intBitsPerPixel = GetDeviceCaps(lngDC, BITSPIXEL)
ReleaseDC 0, lngDC
ColorDepth = intPlanes * intBitsPerPixel
End Function
Private Sub Form_Load()
Dim intColorDepth As Integer
intColorDepth = ColorDepth
MsgBox intColorDepth
End Sub
|
|
|
|
|
|
|