I want to change the frame color of all windows on a PC using the SetSysColor API. i implemeted the API as shown below but nothign happens. No errors but no color change either. I'm testing this on an XP machine.


vb Code:
  1. Public Declare Function SetSysColors Lib "user32" _
  2.                             (ByVal nChanges As Integer, _
  3.                              ByVal lpSysColor As Integer, _
  4.                              ByVal lpColorValues As Integer) As Boolean
  5.  
  6.     Public Declare Function GetSysColor Lib "user32" _
  7.                              (ByVal nIndex As Integer) As Integer
  8.  
  9.     Private Const COLOR_ACTIVECAPTION = 2           'Caption of Active Window
  10.     Private Const COLOR_INACTIVECAPTION = 3         'Caption of Inactive window
  11.     Private Const COLOR_CAPTIONTEXT = 9
  12.  
  13.     Private OriginalActiveColor As Long             ' Holds original active title bar color
  14.     Private OriginalInactiveColor As Long           ' Holds original inactive title bar color
  15.  
  16.  
  17.     Public Sub InitColors()
  18.         OriginalActiveColor = GetSysColor(COLOR_ACTIVECAPTION)
  19.         OriginalInactiveColor = GetSysColor(COLOR_INACTIVECAPTION)
  20.     End Sub
  21.  
  22.     Public Sub ResetColors()    ' Resets the original system colors
  23.         SetSysColors(1, COLOR_ACTIVECAPTION, OriginalActiveColor)
  24.         SetSysColors(1, COLOR_INACTIVECAPTION, OriginalInactiveColor)
  25.     End Sub
  26.  
  27.     Public Sub ChangeColors()
  28.         ' Change active title bar color to black  
  29.         SetSysColors(1, COLOR_ACTIVECAPTION, RGB(0, 0, 0))
  30.         ' Change inactive title bar color to black  
  31.         SetSysColors(1, COLOR_INACTIVECAPTION, RGB(0, 0, 0))
  32.     End Sub