VB Code:
Public Type RGB r as Byte g as Byte b as Byte End Type Public Function GetRGB(lColor as Long) as RGB Dim tmpVar as RGB tmpVar.r = lColor Mod &H100 tmpVar.g = (lColor \ &H100) Mod &H100 tmpVar.b = ((lColor \ &H10000)) Mod &H100 GetRGB = tmpVar End Function 'usage Sub Main() Dim rndColor as Long,rgbVals as RGB Randomize rndColor=RGB(Rnd*255,Rnd*255,Rnd*255) rgbVals = GetRGB(rndColor) Msgbox "Red = " & rgbVals.r & VbCrLf & "Green = " & rgbVals.g & vbCrLf & "Blue = " & rgbVals.b End End Sub




Reply With Quote