Option Explicit Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, ByVal Source As String, ByVal Length As Long)Private Sub Command1_Click() Dim a As String Dim b(10) As Byte a = StrConv("你好", vbUnicode)CopyMemory b(0), a, 4 Debug.Print Hex$(b(0)), Hex$(b(1)), Hex$(b(2)), Hex$(b(3))End Sub注意字节顺序是反的。 最后应该读b(1)b(0),b(3)b(2)
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, ByVal Source As String, ByVal Length As Long)Private Sub Command1_Click()
Dim a As String
Dim b(10) As Byte
a = StrConv("你好", vbUnicode)CopyMemory b(0), a, 4
Debug.Print Hex$(b(0)), Hex$(b(1)), Hex$(b(2)), Hex$(b(3))End Sub注意字节顺序是反的。
最后应该读b(1)b(0),b(3)b(2)
Context_temp = StrConv(Context_temp, vbUnicode, &H404)
Context_temp = StrConv(Context_temp, vbFromUnicode, &H804)