Return an array of RGB when given long 
Author Message
 Return an array of RGB when given long

Hello,

Is there an inverse to the RGB function.  i.e. one that returns an array
of RGB values when given a long?

-Eric



Sat, 31 Jan 2004 19:26:20 GMT  
 Return an array of RGB when given long
Try the following:

Option Explicit
Private Declare Sub MemCopy Lib "kernel32" Alias _
  "RtlMoveMemory" (ByRef Destination As Any, _
  ByRef Source As Any, ByVal Bytes As Long)

Private Sub Command1_Click()
Dim p As Long, b(1 To 4) As Byte
p = Point(100, 100)
'
' convert Long to RGB
MemCopy b(1), p, 4
'
Print "Red =", b(1)
Print "Green =", b(2)
Print "Blue =", b(3)
End Sub

Mike



Quote:
> Hello,

> Is there an inverse to the RGB function.  i.e. one that returns an array
> of RGB values when given a long?

> -Eric



Sat, 31 Jan 2004 20:33:01 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Can a Long returned by CMDialog.Color be converted to RGB

2. Dealing with binary array of longs returned frm DDE

3. BUG: HSL To RGB gives incorrect results

4. RGB Long

5. Extracting RGB from Long

6. Help: converting long integer colour values to RGB

7. Converting Long color value to RGB values

8. Converting long value to RGB

9. RGB Long

10. RGB/long

11. Converting Long <> RGB(x,x,x)

12. Conversion from long to RGB

 

 
Powered by phpBB® Forum Software