码迷,mamicode.com
首页 > 其他好文 > 详细

VB6对象与地址相互转换

时间:2014-12-30 13:31:33      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:

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, 4

    MsgBox c2.Name
    c2.Name = "haha"

    CopyMemory c2, 0&, 4
End Sub

 

VB6对象与地址相互转换

标签:

原文地址:http://www.cnblogs.com/nanfei/p/4193199.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!