7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Type ss
aa(1) As Byte
c As Integer
End Type
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As Any, pSrc As Any, ByVal ByteLen As Long)
Private Sub Command1_Click()
Dim t As ss
Dim b() As Byte
Dim tmp() As Byte
tmp = StrConv("AB", vbFromUnicode)
t.c = 1
Call CopyMemory(t.aa(0), tmp(0), (UBound(tmp) - LBound(tmp) + 1) * LenB(tmp(0)))
ReDim b(LenB(t) - 1)
Call CopyMemory(b(0), t, LenB(t))
Open "b:\1.txt" For Binary As #1
Put #1, , b
Close #1
End Sub