-
July 16th, 2001, 04:37 AM
#1
How Get Count of SafeArray Elements
hi,
how do we get number of elements in a safeArray? Without using SafeArrayAccessData()
thanks
rauf
-
July 16th, 2001, 04:54 AM
#2
Re: How Get Count of SafeArray Elements
The same way you use your computer without turning it on.
Try using SafeArrayGetLBound and SafeArrayGetUBound to determine the amount of elements in the array.
Got a question? try looking it up in MSDN first. Msdn comes with the Visual Studio, and can be found at http://msdn.microsoft.com
---===---
I'm not here for the rates, but rating a post is a good way for me to know how much i helped.
---===---
Daniel
-
July 16th, 2001, 05:00 AM
#3
Re: How Get Count of SafeArray Elements
thanks.
-
March 28th, 2020, 01:14 PM
#4
Re: How Get Count of SafeArray Elements
You will get the count of elements reading a long with offset 16 to safe array pointer.
SA = SafeArrayCreate(VT_DISPATCH, 1, SAB)
cnt = MemLong(SA + 16)
-
March 29th, 2020, 05:17 AM
#5
Re: How Get Count of SafeArray Elements
Where does MemLong() come from??
The structure of SAFEARRAY (returned by SafeArrayCreate() ) is documented at https://docs.microsoft.com/en-us/win...aidl-safearray
As SA is a pointer to this structure, then any info required from this should be accessed via usual structure access methods rather than using a specific offset.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
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
|