Jangogo : 


 

VB
  1. '从对象指针中恢复为对象   
  2. Public Function ObjectFromPtr(ByVal lPtr As LongAs Object  
  3. On Error Resume Next  
  4. Dim objT As Object  
  5.    If Not (lPtr = 0) Then  
  6.          
  7.       ' Author: Bruce McKinney   
  8.       ' Turn the pointer into an illegal, uncounted interface   
  9.       CopyMemory objT, lPtr, 4   
  10.       ' Do NOT hit the End button here! You will crash!   
  11.       ' Assign to legal reference   
  12.       Set ObjectFromPtr = objT   
  13.       ' Still do NOT hit the End button here! You will still crash!   
  14.       ' Destroy the illegal reference   
  15.       CopyMemory objT, 0&, 4   
  16.       ' End Author Bruce McKinney   
  17.          
  18.    End If  
  19. End Function  

 

用法 set  theObj=MyApp.Extender.ObjectFromPtr( lngObjPointer )

文档中心
Copyright © 2000-2016 粤ICP05021785号
地址:广州市天河区员村二横路8号全丰商业大厦808室 邮编:510600