-
A few days ago I found out, that VB6 knows variable with name "RefCount". I have tried to use this variable, but I always getting a message "Out of stack".
I wanted to use this variable to obtain number of references for COM objet. (In C++ a variable with this name is using for reference counting)
Do somebody know, how to employ this variable.
Thanks a lot. Martin
-
Why do you need to get the reference count anyway??
I took the Example from Bruce's book, I don't know much about vtable hacking / reference counting hacks apart from the issues involved in Vtable referencing when you subclass your own ActiveX controls. I'm afraid you're on your own here - and like Bruce said = "Don't go into a hatchet fight without a hatchet" or smoething like that??.....
-
you could do this also:
Code:
Public Function ObjRefCount(obj As IUnknown) As Long
On Error GoTo IsNothing
obj.AddRef ' errs if is Nothing (not set), rtns 0
ObjRefCount = obj.Release
IsNothing:
End Function
'credit to http://www.mvps.org/btmtz