Help with IEnumVARIANT->Next

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with IEnumVARIANT->Next

Michael Curran
Hi,

Was wondering if someone would be able to help me with exactly how to
use the Windows COM interface IEnumVARIANT?

Gecko's MSAA support docs say that you can query interface from an
IAccessible to IEnumVARIANT to collect its children.  I have known about
this for a long time, though I have usually chosen to use the
AccessibleChildren api function from oleacc.dll instead as its just a
bit less fidly.

However, I want to now show the selected item in combo boxes and list
form controls etc in NVDA's virtualBuffers, and as far as I can gather,
IAccessible::accSelection gives you an IEnumVARIANT (held in a VARIANT
of VT_UNKNOWN).

So since both accSelection  gives you an IEnumVARIANT, and because you
can also query to an IEnumVARIANT for getting all children, I want to
cut down on my code duplication a bit and just use IEnumVARIANT rather
than AccessibleChildren.

However, I am having a bit of trouble with IEnumVARIANT->Next.

I can't seem to find much  useful information at all on IEnumVARIANT.

I know that it takes:
long celt
VARIANT* argVar
ULONG* fetched

What does celt mean?

I thought that perhaps I give celt as 0 (as in I want to start from item
0), I allocate an array of variants to the size of accChildCount and
pass that as the VARIANT*, and also provide it with a ULONG* to receive
how many items it was able to give me. But, I always seem to be getting
a COM error when using it.

If anyone could provide me with details on how to use this right I'd be
much appreciative.

Thanks
Mick

_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Help with IEnumVARIANT->Next

Steve Lee-3
I Mick, I just had a quick look and it looks like celt is the number
of elements you want to be returned. So you prolly want accChildCount.
>From what I recall of MS's mangled version of Hungarian notation c ==
'count', so celt prolly means 'count of elements' and in implies an
unsigned int of some sort.

So I guess you set celt to how many you would like it to return in
*argVar and it returns how many it did actual return in fetched (eg if
array smaller that you asked for).

I found docs and a sample implementtation of ::next here
  http://msdn2.microsoft.com/en-us/library/ms221369.aspx

Steve

On 22/01/2008, Michael Curran <[hidden email]> wrote:

> Hi,
>
> Was wondering if someone would be able to help me with exactly how to
> use the Windows COM interface IEnumVARIANT?
>
> Gecko's MSAA support docs say that you can query interface from an
> IAccessible to IEnumVARIANT to collect its children.  I have known about
> this for a long time, though I have usually chosen to use the
> AccessibleChildren api function from oleacc.dll instead as its just a
> bit less fidly.
>
> However, I want to now show the selected item in combo boxes and list
> form controls etc in NVDA's virtualBuffers, and as far as I can gather,
> IAccessible::accSelection gives you an IEnumVARIANT (held in a VARIANT
> of VT_UNKNOWN).
>
> So since both accSelection  gives you an IEnumVARIANT, and because you
> can also query to an IEnumVARIANT for getting all children, I want to
> cut down on my code duplication a bit and just use IEnumVARIANT rather
> than AccessibleChildren.
>
> However, I am having a bit of trouble with IEnumVARIANT->Next.
>
> I can't seem to find much  useful information at all on IEnumVARIANT.
>
> I know that it takes:
> long celt
> VARIANT* argVar
> ULONG* fetched
>
> What does celt mean?
>
> I thought that perhaps I give celt as 0 (as in I want to start from item
> 0), I allocate an array of variants to the size of accChildCount and
> pass that as the VARIANT*, and also provide it with a ULONG* to receive
> how many items it was able to give me. But, I always seem to be getting
> a COM error when using it.
>
> If anyone could provide me with details on how to use this right I'd be
> much appreciative.
>
> Thanks
> Mick
>
> _______________________________________________
> dev-accessibility mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-accessibility
>


--
Steve Lee
--
Jambu - Alternative Access to Computers
www.fullmeasure.co.uk
_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility