Set a new Class module using a pointer to another one
My purpose is to reach a result like this:
but using pointers to object and the CopyMemory API call.
Dim clsA As New Class1
Dim clsB As New Class1
Set clsB = clsA
The reasons why I've to pass trough this way are several and hard to explain.
I tried this code:
but nothing happens, because (although clsA is initialized) clsB always seems to be empty (any property value of clsA is set to clsB).
Dim ptrA As Long, ptrB As Long
ptrA = ObjPtr(clsA)
ptrB = ObjPtr(clsB)
CopyMemory ptrB, ptrA, 4
I also tried to call the ObjPtr() function inside the Class1 module like this:
but neither this time I gave results.
Can you help me?
Re: Set a new Class module using a pointer to another one
You need to place the first set of calls into a normal MODULE, and set the references to PUBLIC. Then, they will be shared throughout the application.