Private Declare Sub vbaCopyBytes Lib "msvbvm60.dll" Alias "__vbaCopyBytes" (ByVal Length As Long, Destination As Any, Source As Any) Dim prot As Long Dim Bytes(1) As BytePrivate Sub Form_Load() prot = 6552 vbaCopyBytes 2, Bytes(0), prot Debug.Print Bytes(0), Bytes(1) End Sub prot = Bytes(1) * &H100 + bytes(0) 对于IP转换成LONG 也可以用这个方法,。
字符串型吗? 我这种用得比较多 dim i as integer ,ch as string i=333 ch=hex(i) ch=string(4-len(ch),"0") & ch debug.print ch 得到结果为 014D
楼上的... 014d 放在字节数组里 a(0)和a(1)???????????
Dim HighByte As Byte, LowByte As Byte Dim Port As Long Port = 54321 HighByte = Port \ 256 LowByte = Port Mod 256 Debug.Print HighByte, LowByte Debug.Print Hex(HighByte), Hex(LowByte)
Dim prot As Long
Dim Bytes(1) As BytePrivate Sub Form_Load()
prot = 6552
vbaCopyBytes 2, Bytes(0), prot
Debug.Print Bytes(0), Bytes(1)
End Sub
prot = Bytes(1) * &H100 + bytes(0) 对于IP转换成LONG 也可以用这个方法,。
我这种用得比较多
dim i as integer ,ch as string
i=333
ch=hex(i)
ch=string(4-len(ch),"0") & ch
debug.print ch
得到结果为
014D
014d 放在字节数组里 a(0)和a(1)???????????
Dim Port As Long
Port = 54321
HighByte = Port \ 256
LowByte = Port Mod 256
Debug.Print HighByte, LowByte
Debug.Print Hex(HighByte), Hex(LowByte)