Link to home
Start Free TrialLog in
Avatar of andyringle
andyringle

asked on

converting access default back color of -2147483633 to RGB value

Trying to get the RGB color for the deafult background color on access forms.  The value is -2147483633.  All the functions I found to not handle negative numbers.   I must be missing something.  This may not be terribly difficult but 500 points to the person that can get me the answer quickest.  thanks


'this function I found on EE does not handle negative values.   ???

Public Sub CompositeRGB( _
  ByVal lngRGB As Long, _
  ByRef intRed As Integer, _
  ByRef intGreen As Integer, _
  ByRef intBlue As Integer)
 
' Calculate discrete RGB colours from composite colour value.
'
' 1999-08-20. Cactus Data ApS, CPH
 
  If lngRGB < 0 Then
    ' Nothing to do.
    intRed = 0
    intGreen = 0
    intBlue = 0
  Else
    ' Dissolve composite RGB into discrete colours.
    intRed = lngRGB And vbRed '
    intGreen = (lngRGB And vbGreen) / &H100
    intBlue = (lngRGB And vbBlue) / &H10000
  End If
  Debug.Print intRed, intGreen, intBlue

End Sub
Avatar of rockiroads
rockiroads
Flag of United States of America image

Taking an educated guess, if its positive, it divies it, what if u multiplied it?

If lngRGB < 0 Then
    ' Nothing to do.
    intRed = lngRGB And vbRed
    intGreen =  (lngRGB And vbGreen) * &H100
    intBlue = (lngRGB And vbBlue) * &H10000
  Else
    ' Dissolve composite RGB into discrete colours.
    intRed = lngRGB And vbRed '
    intGreen = (lngRGB And vbGreen) / &H100
    intBlue = (lngRGB And vbBlue) / &H10000
  End If



not guaranteed to work, but like I said, a guess
Avatar of andyringle
andyringle

ASKER

Rickiroads

Thanks for the suggestion.  I gave it a go.   here is what I got:

Input:
lngRGB = -2147483633

Output:
intRed  = 15
intGreen  = 0
intBlue  = 0

This give me a color close to Black.  

I will keep trying other ways.....Any other suggestions......

Andy







ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
YOU GOT IT!!

Input:
lngRGB = -2147483633

Output:
R              236
G              233
B              216


I did a test and it worked great!  Thanks for the help

FYI...I did some checking and the standard windows colors are as follows:


Color ID... Color Description
----------- -----------------
-2147483648 Scroll bar
-2147483647 Desktop
-2147483646 Active window title bar
-2147483645 Inactive window title bar
-2147483644 Menu bar
-2147483643 Window
-2147483642 Window frame
-2147483641 Menu Text
-2147483640 Window Text (*)
-2147483639 Title bar text
-2147483638 Active window border
-2147483637 Inactive window border
-2147483636 Application background
-2147483635 Highlight
-2147483634 Highlight Text
-2147483633 3-D face (**)
-2147483632 3-D shadow
-2147483631 Dimmed (disabled) text
-2147483630 Button Text
-2147483629 Inactive window title bar text
-2147483628 3-D highlight (***)
-2147483627 3-D dark shadow
-2147483626 3-D light
-2147483625 ToolTip Text
-2147483624 ToolTip background
-2147483621 Active window title bar color2


Will use that function to conver the colors above to RGB.

Nice!
Rickiroads:

Thanks again for the help!