Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

US Job listings




   Misc

   Amazon

   Links

    


Amount of colours available
 

 

 

Description

get the amount of colors available

Author

Programmershelp

Code

Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Const PHYSICALOFFSETX = 112
Private Const PHYSICALOFFSETY = 113
Private Const PLANES = 14
Private Const BITSPIXEL = 12

Public Function GetNumberColors() As Long
Dim hSrcDC As Integer

hSrcDC = GetDC(GetDesktopWindow())
GetNumberColors = GetDeviceCaps(hSrcDC, PLANES) * 2 ^ GetDeviceCaps(hSrcDC, BITSPIXEL)
Call ReleaseDC(GetDesktopWindow(), hSrcDC)
End Function

Information

tested using Visual Basic 6 , Windows 2000 , XP

 

 

 

 

Download

amountcolors.txt


 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
Open copy disk dialog(VB)
Display the Day / Hour / Month / Minute / Second etc(ASP)
Lottery number generator(PHP)
Display the dimensions of an image(PHP)
Factorial function(ASP)
list files of a certain type in a word document(VBScript)
total amount of function keys(VB)
break out of a loop(php)

    




Copyright © 2003 by programmershelp.co.uk