|
-
Dec 14th, 2023, 06:00 PM
#3
New Member
Re: Here's how to reference the same variable in 2 different ways.
 Originally Posted by wqweto
If you put &H81 in fFeatures you won't have to cleanup the array (last PutMem4) *and* your running project can be safely terminated with End button while array aliasing is active.
Here is an explanation of the magic numbers:
FADF_HAVEVARTYPE 0x0080 An array that has a variant type. The variant type can be retrieved with SafeArrayGetVartype.
FADF_AUTO 0x0001 An array that is allocated on the stack.
cheers,
</wqw>
Is it possible to achieve this with an array which has been created with COM Safearray api? SafeArrayAllocDescriptorEx with fFeatures = &H81 + SafeArrayAllocData etc.
I create an alias this way:
Dim adblAlias() as Double
CopyMemory ByVal VarPtrArray(adblAlias), pSafeArrayReturnedFromSafeArrayAllocDescriptorEx, SIZEOF_VBA_LONGPTR
adblArray(1, 1) = 5
But it crashes when adblAlias goes out of scope.
(It works if I wipe adblAlias afterwards)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|