
How to find out Windows color setting?
Quote:
> Hi!
> Is there a way to tell whether the computer a VB program
> is running on has 256 color or 16 color or 65K color
> setting?
> It would be nice if my program can display a 16 color
This works for me...
Declare Function GetDeviceCaps% Lib "GDI" (ByVal hDC%, ByVal nIndex%)
Declare Function CreateDC% Lib "GDI" (ByVal lpDriverName$, ByVal lpDeviceName$, ByVal lpOutput$, ByVal lpInitData As Any)
Declare Function DeleteDC% Lib "GDI" (ByVal hDC%)
Global Const BITSPIXEL = 12
Global Const PLANES = 14
Sub GetColorDepth ()
Dim hDC%, x%, pl%, bp%
'create a device context...
hDC = CreateDC("DISPLAY", "", "", "")
pl% = GetDeviceCaps(hDC, PLANES)
bp% = GetDeviceCaps%(hDC, BITSPIXEL)
'this is the number of colors the display driver can support...
sColors& = 2 ^ CLng(pl% * bp%)
'delete the device context...
x = DeleteDC(hDC)
End Sub