I’d like to get a pointer of myClass Instance :
Dim MyNewInst As New MyClass
Dim MyPointer As Ptr = Pointer (MyNewInst) => How to do that ?
Dim v as variant
v = MyNewInst
Dim MyPointer as Ptr = v.PtrValue
does not work either
The reason why I need it : I need a COM IDispatch Interface associated with MyNewInst
Dim disp As New COM.IDispatch (MyPointer)
I tried this, but it is obviously wrong :
Dim mTest as MemoryBlock = COM.RBVariantToVARIANT (MyNewInst, true)
Dim pTest as Ptr = mTest
Dim disp As New COM.IDispatch (pTest)
ADDRESSOF is intended to get a pointer from methods only, not class instances :
Dim p As Ptr = ADDRESSOF MyMethod
a) You cannot get a pointer to a Xojo class.
b) Classes created in Xojo are not COM components.
You are right of course. Sorry for my stupid question
I am having difficulties with IDataObject Interface, I don’t know how to create it.
I can manage easily the following COM interfaces :
IUnknown => IRichEditOLE => ITextDocument => ITextRange, getting IOleObject, …
But I can’t create the IDataObject I need in : ITextRange::Paste method
There is no IDataObject I could retrieve from ITextRange with QueryInterface.
They say :
HRESULT Paste (VARIANT *pVar, long Format );
The IDataObject to paste. However, the contents of the clipboard are used if any of the following are true.
pVar is null
pVar punkVal is null
pVar is not VT_UNKNOWN
pVar punkVal does not return an IDataObject when queried for one
What means punkVal ?