Hi again, does anybody know how to get the number of colours / colour depth which the display is set to use, in Visual Basic 6?
(i.e. 8-bit, 16-bit or 32-bit)
I know how to find out the horizontal/vertical resolution, but it's the depth I need...
4 1726
Hi again, does anybody know how to get the number of colours / colour depth which the display is set to use, in Visual Basic 6?
(i.e. 8-bit, 16-bit or 32-bit)
I know how to find out the horizontal/vertical resolution, but it's the depth I need...
Sourced from another forum... Author: James Crowley
This piece of code shows you how to find out the colour depth of the screen using the GetDeviceCaps API. - Private Declare Function GetDeviceCaps Lib "GDI32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
-
-
Function DeviceColors(hDC As Long) As Single
-
Const PLANES = 14
-
Const BITSPIXEL = 12
-
DeviceColors = 2 ^ (GetDeviceCaps(hDC, PLANES) * GetDeviceCaps(hDC, BITSPIXEL))
-
End Function
-
-
Private Sub cmdGetColours_click()
-
Dim fColours As Single
-
fColours = DeviceColors(hDC)
-
If fColours = 4294967296# Then
-
Debug.Print "Colors: " & fColours & " - True Color (32 bit)"
-
ElseIf fColours = 65536# Then
-
Debug.Print "Colors: " & fColours & " - High Color (16 bit)"
-
Else
-
Debug.Print "Colors: " & fColours
-
End If
-
End Sub
(Edited by Killer42. The original code contained bugs. I'll post it in another message, for historical interest.)
Just in case anyone is interested, here is the original code, before I edited it. Warning: This code contains at least one serious bug (in the test code, not the actual function) - Private Declare Function GetDeviceCaps Lib "GDI32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
-
-
Function DeviceColors(hDC As Long) As Single
-
Const PLANES = 14
-
Const BITSPIXEL = 12
-
DeviceColors = 2 ^ (GetDeviceCaps(hDC, PLANES) * GetDeviceCaps(hDC, BITSPIXEL))
-
End Function
-
-
Private Sub cmdGetColours_click()
-
Dim fColours As Single
-
fColours = DeviceColors((hDC))
-
If fColours = "4.294967E+09" Then
-
lblColours.Caption = "Colors: " & Colours & " -True Color (32 bit)"
-
ElseIf fColours = "65536" Then
-
lblColours.Caption = "Colors: " & Colours & " - High Color (16 bit)"
-
Else
-
lblColours.Caption = "Colors: " & Colours
-
End If
-
End Sub
Sourced from another forum...
This piece of code shows you how to find out the colour depth of the screen using the GetDeviceCaps API.
...
(Edited by Killer42. The original code contained bugs. I'll post it in another message, for historical interest.)
Thanks very much! ^^
Works just like it should.
Thanks very much! ^^
Works just like it should.
Glad to hear it! :)
I might add this to the Articles area.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: John Hunter |
last post by:
I have a largish data set (1000 observations x 100 floating point
variables), and some of the of the data are missing. I want to try a
variety of clustering, neural network, etc, algorithms on the data,
and to keep life simple I want to reduce the dimensions of the matrix
so that I have no missing values, since not all the algorithms are
able to handle them and there is sufficient redundancy in the
variables that I can afford to lose...
|
by: Michael Bierman |
last post by:
Please forgive the simplicy of this question. I have the following code
which attempts to determine the color of some text and set other text
to match that color. It works fine in Firefox, but does nothing in IE.
I'd be greatful for any assistance. Also, if I will have problems the
code on Opera or Safari, I'd appreciate any pointers--I don't have a
Mac to test Safari.
THanks very much,
Michael
|
by: scoobydoo |
last post by:
hi,
I have a problem displaying icons at the right colour depthin a
ListView.
I've made an icon file, (using IconWorkshop 5), it has 3 icons within
it. A 32x32 32bpp XP style icon, a 32x32 32bpp non-xp icon (no
transparency), and a 16x16 version.
I add these icons to an ImageList, which is then assigned to the
LargeImageList property of the ListView.
|
by: Paul Cheetham |
last post by:
Hi,
I have several Colour custom cursors embedded in my application resource.
In order to load and use them I use the following function:
public static Cursor LoadCursor (string CursorName)
{
Cursor myCursor;
Stream cursorStream;
Assembly thisAssembly;
|
by: johkar |
last post by:
I need to cancel the link and execute a function onclick of all the
links within the span tag which has a class of "container" assigned.
There will be only one span tag with this class applied.
I know you can get a specific tag using
document.getElementsByTagName('span'), but I am unsure how to get
the one with the class="container". I know there is a getAttribute
method, just need a pointer or two to put it all together. Once I know...
| |
by: Dave White |
last post by:
Hello Everyone,
I have not had any luck finding a tool that will:
Shows me the color when I highlight a Hex color code in an HTML source
document.
Are there any utilities that do this?
Thanks in advance,
|
by: kuratkull |
last post by:
Hello,
I haven't asked If I wasn't really confused :)
OK, so I am just beginning SDL programming in C, and I was running fine, until I tried getting a pixel colour.
Basically, I am trying to run the code from this page:
http://www.libsdl.org/cgi/docwiki.cgi/Pixel_20Access
This is the cut down version of my code:
|
by: cjstuttle |
last post by:
Could anyone help me, I'm a python noob and need some help. im trying
to find some code that will, given a screen co-ordinate, will give me
the colour of that pixel in RGB. i have found a lot about getting the
pixel colour from a picture file with a given co-ordinate, but is it
possible to do it from the whole screen output regardless what
application the selected pixel is in?
any help would be help.
thanks, Chris
|
by: Mas Juliza Alias |
last post by:
Hi,
I am building a program on Information System for Reservoir Operation for my Masters research. Now I have a text file which is an output file from a processing software (Terramodel) that lists out Elevation Range and Volume in columns and rows. The text file looks like this;
-------------------------------------------------
-software's distributor address-
-project description-
Depth range Volume
(m) ...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |