ObjPtr function exists but officially not documented due to the reason that Microsoft don't want programmers to play with pointers in VB.
It is also hidden in VB's Object Browser. To see its definition, select Show Hidden Members from context menu, and search for "objptr".
This is all about ObjPtr that I found in Microsoft KnowledgeBase article #Q199824.
___
ObjPtr
------
ObjPtr takes an object variable name as a parameter and obtains the address of the interface referenced by this object variable.
One scenario of using this function is when you need to do a collection of objects. By indexing the object using its address as the key, you can get faster access to the object than walking the collection and using the Is operator. In
many cases, the address of an object is the only reliable thing to use as a key.
Example:
objCollection.Add MyObj1, CStr(ObjPtr(MyObj1))
...
objCollection.Remove CStr(ObjPtr(MyObj1))
___
One thing to note that ObjPtr is the not only way to obtain the object pointer. In fact
[tt]
Dim lngVar As Long
lngVar = ObjPtr(anObject)
[/tt]
is equivalent to
[tt]
Dim lngVar As Long
CopyMemory lngVar, anObject, 4
[/tt]