How to find out Windows color setting? 
Author Message
 How to find out Windows color setting?

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
bitmap on a 16 color setting, but a different 256 color
bitmap on a 256 color setting.  If I only use one bitmap
it doesn't look good on different color settings.

Thanks in advance!

Shan



Mon, 04 Aug 1997 10:23:07 GMT  
 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



Wed, 06 Aug 1997 05:53:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Finding Out Windows Color Settings?

2. Windows API call to set windows colors (HELP Please)

3. setting all foreground and bkground colors to use window's current color setting

4. How to set/retrieve Windows System Colors Using API and VBA

5. Help Setting Colors in Windows Help

6. Changing Color Settings in Windows 95, 98

7. How do I get/set what customized colors are in the color dialog box

8. color palette not accessible in 256+ color settings

9. university EMR send outs

10. on the outs

11. Learning the ins and outs of Peek and Poke

12. How to handle print outs in VB?

 

 
Powered by phpBB® Forum Software