Article View: comp.windows.ms.programmer
Article #570WinApps detecting 24-bit Video Drivers
From: 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;
}
Technical Details
Message-ID:
<599@nih-csl.nih.gov>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!ncifcrf!lhc!nih-csl!helix.nih.govShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!ncifcrf!lhc!nih-csl!helix.nih.gov From: bert@helix.nih.gov (Bert Tyler) Newsgroups: comp.windows.ms.programmer Subject: WinApps detecting 24-bit Video Drivers Message-ID: <599@nih-csl.nih.gov> Date: 5 Nov 90 12:52:37 GMT Sender: news@nih-csl.nih.gov Organization: National Institutes of Health, Bethesda Lines: 39