VB6对象与地址相互转换

时间:2024-01-17 10:30:20
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(lpDest As Any, lpSource As Any, ByVal nCount As Long) Private Sub Form_Load()
Dim c As New clsTest
c.Name = "Hello,World!" Dim addr As Long
addr = ObjPtr(c) Dim c2 As clsTest
CopyMemory c2, addr, MsgBox c2.Name
c2.Name = "haha" CopyMemory c2, &,
End Sub