Trucos Hallar el número de colores en windows 95   (2 artículos )

Private Declare Function GetDeviceCaps Lib "gdi32"
       (ByVal hdc As Long, ByVal nIndex As Long) As Long

 dim i as long

 i = (2 ^ GetDeviceCaps(Form1.hdc, 12)) ^ GetDeviceCaps(Form1.hdc, 14)

 debug.print "Nº de colores soportados : " & i

Private Declare Function GetDeviceCaps Lib "gdi32"
       (ByVal hdc As Long, ByVal nIndex As Long) As Long


Dim numcol as Integer, bitxpixel As Integer
numcol = GetDeviceCaps(Form1.hdc, 12)
If numcol = 1 Then
   bitxpixel = GetDeviceCaps(Form1.hdc, 14)
   If bitxpixel = 1 Then
      msgbox "1 bit por pixel : 2 colores"
   ElseIf bitxpixel = 4 Then
      msgbox "4 bits por pixel : 16 colores"
   End If
ElseIf numcol = 8 Then
       msgbox "8 bits por pixel : 256 colores"
ElseIf numcol = 16 Then
       msgbox "16 bits por pixel : 65000 colores"
Else
       msgbox = "16 millones de colores"
End If



Trucos Trucos

Visual Basic Página de Visual Basic

Página principal Página principal

www.jrubi.com