Visual Basic Core Snippet Routines
DesktopsSameColourFormat
          
                 
   Returns True if all display monitors on a multi-monitor system have the same color format, or False otherwise. If a single monitor system, the function returns True.     
           Updated:   Monday December 26, 2011   
click to copy code:  



   Applies to:   VB4-32, VB5, VB6   
OS restrictions:   Win 98/Me, 2000/XP  
 Code Snippet
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce 
'               or publish this code on any web site,
'               online service, or distribute as source 
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Const SM_SAMEDISPLAYFORMAT As Long = 81
Private Const SM_CMONITORS As Long = 80
         
Private Declare Function GetSystemMetrics Lib "user32" _
   (ByVal nIndex As Long) As Long
   
Private Function DesktopsSameColourFormat() As Boolean

  'Check if all display monitors have
  'the same color format. Call returns
  'True if they do, or FALSE otherwise.
  
  'Note that two displays can have the same
  'bit depth, but different color formats.
  'For example, the red, green, and blue
  'pixels can be encoded with different
  'numbers of bits, or those bits can be
  'located in different places in a pixel's
  'color value.
   
  'This method checks for multiple monitors
  'before determining whether the same color.
  'If the system has only 1 monitor, just
  'return True.
   If IsMultiMonitorSystem() Then
      DesktopsSameColourFormat = GetSystemMetrics(SM_SAMEDISPLAYFORMAT) = 1
   Else
      DesktopsSameColourFormat = True
   End If

End Function


Private Function IsMultiMonitorSystem() As Boolean

  'Returns True if a multi-monitor system
   IsMultiMonitorSystem = GetSystemMetrics(SM_CMONITORS) > 1

End Function

 Calling Syntax
   dwSameClrFormat = DesktopsSameColourFormat()

 Comments / Related
demo in use:   EnumDisplayMonitors: Enumerating System Monitor Info
Related:   Core: DesktopsSameColourFormat
Core: GetDesktopMaximumHeight
Core: GetDesktopMaximumWidth
Core: GetMonitorByPoint
Core: GetMontitorByRect
Core: GetMonitorByWindow
Core: GetMonitorCount

 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright ©1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy

 

Hit Counter