Subscribe via Email

Enter your email address to subscribe and receive notifications of new content by email.

get the amount of colors available

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

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInWhatsAppBibSonomyDeliciousDiggDiigoSina WeiboWordPressBlogger PostShare

Leave a Reply





You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>