Search notes:

VBA function: objPtr

objPtr(obj) returns a pointer to the IUnknown interface of the object obj.
varPtr applied to an object returns the address of the memory location that objPtr returns:
option explicit

sub main() ' {

    dim o       as new obj

    dim obj_ptr as longPtr
    dim var_ptr as longPtr

    obj_ptr = objPtr(o)
    var_ptr = varPtr(o)

    debug.print "var_ptr          = " & var_ptr
    debug.print "obj_ptr          = " & obj_ptr
  '
  ' var_ptr points at obj_ptr
  '
    debug.print "GetMem4(var_ptr) = " & GetMem4_(var_ptr)

end sub ' }

' var_ptr          = 2093616
' obj_ptr          = 93661960
' GetMem4(var_ptr) = 93661960
Github repository about-VBA, path: /functions/objPtr/varPtr-objPtr.bas
If objPtr of an object variable returns 0, the object variable is considered to be nothing.

See also

varPtr and strPtr
Classes: reference counting

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745453502, '13.59.203.127', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/VBA/functions/objPtr/index(73): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78