Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1460

RGB TO LONG,Long to rgb-vb6

$
0
0
Code:

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Type LongType
    longV As Long
End Type
Private Type RGBN
    R As Byte
    G As Byte
    b As Byte
    N As Byte
End Type

Private Sub Form_Load()
    Dim RGBN1 As RGBN
    Dim Long1T As LongType
    Dim Long2T As LongType
    Long1T.longV = RGB(11, 22, 33)
    LSet RGBN1 = Long1T
    LSet Long2T = RGBN1
    MsgBox "Long1=" & Long1T.longV & vbCrLf _
        & RGBN1.R & "," & RGBN1.G & "," & RGBN1.b & vbCrLf _
        & Long2T.longV
End Sub

Sub TEST2()
    Dim Long1 As Long, RGBN1 As RGBN, Long2 As Long
    Long1 = RGB(11, 22, 33)
   
    CopyMemory RGBN1, Long1, 4
   
    CopyMemory Long2, RGBN1, 4
    MsgBox "Long1=" & Long1 & vbCrLf _
    & RGBN1.R & "," & RGBN1.G & "," & RGBN1.b & vbCrLf _
    & "Long2=" & Long2
End Sub


Viewing all articles
Browse latest Browse all 1460

Trending Articles