Re: How to use ROT or IUnknown in VB? THE SOULTION
I have a solution from one of my workmate.
I could pass the IUnknown* of the object to a C++ function where I could
register the object in ROT.
HRESULT RegisterInROT([in] VARIANT varUnknown, [in] BSTR bstrID, [out, retval]
long * pCookie);
Dim szID As String
Dim rot As ROTHandlerInCpp
Dim obj As IUnknown
Dim gnCookie As Long
szID = "ID_IN_ROT"
Set rot = New ROTHandlerInCpp
Set obj = Form1.TableTree1
gnCookie = rot.RegisterInROT(ObjPtr(obj), szID)
The key is : ObjPtr(obj), which is address of the tree object.
The pointer is passed as an integer instead of an IUnknown* in the variant.
It's not so beautiful, but works if I cast it back to IUnknown*.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center