ObjectFromPtr 方法
(创建时间:2012年09月01日 06:15:00)
Jangogo :
VB
- '从对象指针中恢复为对象
- Public Function ObjectFromPtr(ByVal lPtr As Long) As Object
- On Error Resume Next
- Dim objT As Object
- If Not (lPtr = 0) Then
- ' Author: Bruce McKinney
- ' Turn the pointer into an illegal, uncounted interface
- CopyMemory objT, lPtr, 4
- ' Do NOT hit the End button here! You will crash!
- ' Assign to legal reference
- Set ObjectFromPtr = objT
- ' Still do NOT hit the End button here! You will still crash!
- ' Destroy the illegal reference
- CopyMemory objT, 0&, 4
- ' End Author Bruce McKinney
- End If
- End Function
用法 set theObj=MyApp.Extender.ObjectFromPtr( lngObjPointer )
文档中心