Hello,
I was wondering whether it is possible to remove object from memory using CopyMemory function.
Here is the code I've written in order to fulfill discussed task:
Code:
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
( _
ByRef Destination As Any, _
ByRef Source As Any, _
ByVal Length As Long _
)
Sub test()
Dim Object_ As SampleClass
Set Object_ = New SampleClass
Object_.name = "name"
Dim ptr As Long
ptr = ObjPtr(o)
Call CopyMemory(ByVal ptr, ByVal Null, 1000&)
End Sub
Value of 1000&, passed to the CopyMemory function, is a dummy object size, hardcoded by me.
If someone of you knows the way of how to count size of the custom object, then please provide instruction on how to accomplish this.
Bookmarks