Thread View: comp.windows.ms.programmer
2 messages
2 total messages
Started by Bert Tyler
Mon, 05 Nov 1990 12:52
WinApps detecting 24-bit Video Drivers
Author: Bert Tyler
Date: Mon, 05 Nov 1990 12:52
Date: Mon, 05 Nov 1990 12:52
39 lines
2034 bytes
2034 bytes
How should a WinApp check for the presence of a 24-bit (IE, > 256 colors)
video driver?
When I wrote WINFRACT, I had access to a 16-color driver (vanilla VGA)
and a 256-color driver (the 8514/A), and didn't consider 24-bit video
drivers at all. Now I'm getting a little concerned that the program
won't act correctly if it finds itself on a 256-color driver.
Given that WINFRACT is, for other reasons, pretty much limited to the
256-color world at the moment, I would like it to treat a 24-bit video
driver just like a 256-color driver (I'm assuming that Windows will
automatically handle the fact that *my* 256 colors can be different
from the *other guy's* 256 colors).
So, anyway, what is going to happen to the current detection logic
(copied below) if it finds itself on a 24-bit video driver? What
should I be doing differently?
(At the moment, 'iNumColors' and 'colors' are both declared 'int').
---------------------------
hDC = GetDC(NULL);
iPalSize = GetDeviceCaps (hDC, SIZEPALETTE);
iRasterCaps = GetDeviceCaps (hDC, RASTERCAPS);
iRasterCaps = (iRasterCaps & RC_PALETTE) ? TRUE : FALSE;
if (iRasterCaps)
iNumColors = GetDeviceCaps(hDC, SIZEPALETTE);
else
iNumColors = GetDeviceCaps(hDC, NUMCOLORS);
ReleaseDC(NULL,hDC);
colors = iNumColors;
if (colors != 2 && colors != 16 && colors != 256) {
/* NOTE: the next two statements were *reversed* in the
public versions of WINFRACT - oops */
if (colors > 16) colors = 256;
if (colors > 2) colors = 16;
}
Re: WinApps detecting 24-bit Video Drivers
Author: Chris GUZAK
Date: Tue, 06 Nov 1990 18:18
Date: Tue, 06 Nov 1990 18:18
17 lines
1100 bytes
1100 bytes
In article <599@nih-csl.nih.gov> bert@helix.nih.gov (Bert Tyler) writes: >How should a WinApp check for the presence of a 24-bit (IE, > 256 colors) >video driver? 24 bit and 16 bit displays will return -1 for NUMCOLORS (since GetDeviceCaps() only returns 16 bits. You can also check NUMPLANES * BITSPIXEL > 8 also indicates a > 256 color device. Palettes will be mapped to nearest colors on these devices so you will get what you expect. People should be careful with the returns from NUMPLANES and BITSPIXEL. Improper use of these parameters are almost always the cause of regular windows programs not running on 24 bit displays. Chris Guzak
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads