VB Code:
  1. Public Type RGB
  2.     r as Byte
  3.     g as Byte
  4.     b as Byte
  5. End Type
  6.  
  7. Public Function GetRGB(lColor as Long) as RGB
  8.     Dim tmpVar as RGB
  9.     tmpVar.r = lColor Mod &H100
  10.     tmpVar.g = (lColor \ &H100) Mod &H100
  11.     tmpVar.b = ((lColor \ &H10000)) Mod &H100
  12.     GetRGB = tmpVar
  13. End Function
  14.  
  15.  
  16. 'usage
  17. Sub Main()
  18.     Dim rndColor as Long,rgbVals as RGB
  19.     Randomize
  20.     rndColor=RGB(Rnd*255,Rnd*255,Rnd*255)
  21.     rgbVals = GetRGB(rndColor)
  22.     Msgbox "Red = " & rgbVals.r & VbCrLf & "Green = " & rgbVals.g & vbCrLf & "Blue = " & rgbVals.b
  23.     End
  24. End Sub