# of Colors

  • Thread starter Thread starter Dave Ruhl
  • Start date Start date
D

Dave Ruhl

Is there a way, in Access 2002, to determine the # of
colors the graphics card is currently set to ? Thanks...
 
You should learn how to search on GoogleGroups as it is an invaluable
tool.

From: Tom Esh ([email protected])
Subject: Re: GetDeviceCaps


View this article only
Newsgroups: microsoft.public.vb.winapi
Date: 2002-09-17 01:56:10 PST


I wish you would just jot down an example for me so i can see actual
parameters. the thing is: in the examples i have seen, parameters, such as
Form1.hdc or just hDC, are passed. Forms do not have an hdc property and
these variables are not declared in the examples. So, being new (a complete
novice) to API, I just dont get it. Please show me a practical example

What language are you working in? VB forms ~do~ have a hDC property.
Anyhow if the app has no forms, to fetch display device caps ~any~
window's DC will do, including the desktop.
For example to retreive the current system color depth (bits):

'declares...
Public Const BITSPIXEL = 12
Public Declare Function GetDeviceCaps Lib "gdi32" _
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Public Declare Function GetDC Lib "user32" _
(ByVal hwnd As Long) As Long
Public Declare Function ReleaseDC Lib "user32" _
(ByVal hwnd As Long, ByVal hdc As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long

'usage...
Dim hwndDesk As Long, DC As Long
hwndDesk = GetDesktopWindow()
DC = GetDC(hwndDesk)
Debug.Print GetDeviceCaps(DC, BITSPIXEL)
ReleaseDC hwndDesk, DC




--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Thanks Stephen, I tried this code and, though it didn't
give me the # of colors (256, 16 million, etc...) it does
tell me the bits (8, 32, etc...) which will work just as
well for me. Thanks !

BTW, I did try searching GoogleGroups and your website
and didn't find anything. Maybe I was just using the
wrong parameters.
 
Back
Top