Dim byte1 As Byte, byte2 As Byte, byte3 As Byte, byte4 As Byte
Dim sum As Long
sum = 255& * 255& * 255& * 15
byte1 = sum \ 255 \ 255 \ 255
byte2 = (sum - byte1 * 255& * 255& * 255&) \ 255
byte3 = sum - byte1 * 255& * 255& * 255& - byte2 * 255& * 255&
byte4 = sum - byte1 * 255& * 255& * 255& - byte2 * 255& * 255& - byte3 * 255&
MsgBox sum = byte1 * 255& * 255& * 255& + byte2 * 255& * 255& + byte3 * 255& + byte4
MsgBox 10 \ 3 ' выведет 3
L=36.6
Option Explicit
Private Type l
l As Long
End Type
Private Type b
a As Byte
b As Byte
c As Byte
d As Byte
End Type
Private Sub Form_Load()
Dim l As l, b As b
l.l = &H12345678
LSet b = l
MsgBox Hex$(b.d) & "-" & Hex$(b.c) & "-" & Hex$(b.b) & "-" & Hex$(b.a)
End Sub
Option Explicit
Private Type l
l As Long
End Type
Private Type b
a As Byte
b As Byte
c As Byte
d As Byte
End Type
Private Sub Form_Load()
Dim l As l, b As b
b.a = &H78
b.b = &H56
b.c = &H34
b.d = &H12
LSet l = b
MsgBox Hex$(l.l)
End Sub
Dim m(3) As Byte, a As Long
a = &H343E45CA
CopyMemory m(0), a, 4
Debug.Print Hex(m(3)), Hex(m(2)), Hex(m(1)), Hex(m(0))
Сейчас этот форум просматривают: Majestic-12 [Bot] и гости: 148