C
CSharp
C++
Java
Visual Basic
HTML - CSS
Android
Asp
Asp.Net
Php
Python
JavaScript
SQL
XML
Assembly
ActiveX
API
Code Snippets
Database
Files Directories Drives
Forms
Graphics Games
Multimedia
Strings
Windows and Controls
More...
Visual Basic > Graphics Games Programming sample source codes
Visual Basic Code > Getting the Colour Depth
Getting the Colour Depth 'API Declarations Declare Function GetDesktopWindow Lib "User32" () As Long Declare Function GetDC Lib "User32" _ (ByVal hWnd As Long) As Long Declare Function ReleaseDC Lib "User32" _ (ByVal hWnd As Long, ByVal hDC As Long) As Long Declare Function GetDeviceCaps Lib "GDI32" _ (ByVal hDC As Long, ByVal nIndex As Long) As Long 'Choose this version for use in a .BAS Module. Public Function GetColours() As Long 'Define some Constants we will use. Const PLANES = 14 Const BITSPIXEL = 12 'We use the hDC of the Desktop Window. hDC = GetDC(GetDesktopWindow()) 'Calculate the colour depth. GetColours = 2 ^ (GetDeviceCaps(hDC, PLANES) * _ GetDeviceCaps(hDC, BITSPIXEL)) 'Clear up. ReleaseDC GetDesktopWindow(), hDC End Function
Privacy Policy
|
Contact
|
Advertising
|
Link to Us
|
Directory