7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Sub Command1_Click()
Dim l As Long
l = RGB(0, 255, 0)
Dim r As Byte
Dim g As Byte
Dim b As Byte
getrgb l, r, g, b
End Sub
Private Sub getrgb(ByVal c As Long, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
If c < 0 Then
c = c + 2 ^ 32
End If
r = c Mod 256
g = (c \ 256) Mod 256
b = (c \ 65536) Mod 256
End Sub
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" ( _
ByVal Destination As Long, _
ByVal Source As Long, _
ByVal Length As Long)
Private Sub Command1_Click()
Dim I As Long, J(3) As Byte
I = 16243629
CopyMemory VarPtr(J(0)), VarPtr(I), 4
Debug.Print "R=" & Hex(J(0)) & " G=" & Hex(J(1)) & " B=" & Hex(J(2))
End Sub