<font size=2>Thanks for your interest and patience. &nbsp; The following
code seems to be working. &nbsp;It shows a CLIENT fragment that calls for
the key bindings and then pulls them off for processing. &nbsp; The SERVER
snippet shows how I am building a simple three element BSTR array. &nbsp;
&nbsp;Please advise if you see any stupid errors being made.</font>
<br>
<br><font size=2>Thanks!</font>
<br>
<br><font size=2>Brian</font>
<br>
<br><font size=2>CLIENT:</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = m_spAccessible2-&gt;QueryInterface(IID_IAccessibleAction,(</font><font size=2 color=blue>void</font><font size=2>**)&amp;m_spAccessibleAction);</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>long</font><font size=2>
nActions = 0L;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = m_spAccessibleAction-&gt;nActions(&amp;nActions);</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>if</font><font size=2>(SUCCEEDED(res)){</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; BSTR name;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; BSTR description;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </font><font size=2 color=blue>for</font><font size=2> (</font><font size=2 color=blue>int</font><font size=2>
iAction=0 ; iAction&lt;nActions; iAction++){</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = m_spAccessibleAction-&gt;get_name(iAction,
&amp;name);</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>if</font><font size=2>(SUCCEEDED(res)){</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; Process(name); &nbsp;</font><font size=2 color=#008000>//
Process the name and free the string</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = m_spAccessibleAction-&gt;get_description(iAction,
&amp;description);</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>if</font><font size=2>(SUCCEEDED(res)){</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; Process(description); </font><font size=2 color=#008000>//
Process the name and free the string</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BSTR *aKeyBindings;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>long</font><font size=2>
aNumMaxBinding = 10;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>long</font><font size=2>
aNumBindings;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = m_spAccessibleAction-&gt;get_keyBinding(iAction,
aNumMaxBinding, &amp;aKeyBindings, &amp;aNumBindings);</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>if</font><font size=2>(SUCCEEDED(res)){</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </font><font size=2 color=blue>for</font><font size=2> (</font><font size=2 color=blue>int</font><font size=2>
jBind=0; jBind&lt;aNumBindings; jBind++){</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Process(aKeyBindings[jBind]);
</font><font size=2 color=#008000>// Process the name and free the string</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; }</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; CoTaskMemFree(aKeyBindings);</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; }</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br>
<br><font size=2>SERVER:</font>
<br><font size=2>STDMETHODIMP AccServer::get_keyBinding(</font><font size=2 color=blue>long</font><font size=2>
aActionIndex, </font><font size=2 color=blue>long</font><font size=2> aNumMaxBinding,</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BSTR **aKeyBinding,</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>long</font><font size=2>
*aNumBinding)</font>
<br><font size=2>{</font>
<br>
<br><font size=2>&nbsp; &nbsp; *aKeyBinding = </font><font size=2 color=blue>static_cast</font><font size=2>&lt;BSTR*&gt;(CoTaskMemAlloc((aNumMaxBinding)
* </font><font size=2 color=blue>sizeof</font><font size=2>(BSTR*)));</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>if</font><font size=2>
(!*aKeyBinding) </font><font size=2 color=blue>return</font><font size=2>
E_OUTOFMEMORY;</font>
<br>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; *aKeyBinding[0] = ::SysAllocString(OLESTR(</font><font size=2 color=#a11f12>&quot;0
key binding&quot;</font><font size=2>));</font>
<br><font size=2 color=#008000>// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;if (!*(aKeyBinding[0])) return E_OUTOFMEMORY;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; (*aKeyBinding)[1] = ::SysAllocString(OLESTR(</font><font size=2 color=#a11f12>&quot;1
key binding&quot;</font><font size=2>));</font>
<br><font size=2 color=#008000>// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;if (!*(aKeyBinding[1])) return E_OUTOFMEMORY;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; (*aKeyBinding)[2] = ::SysAllocString(OLESTR(</font><font size=2 color=#a11f12>&quot;2
key binding&quot;</font><font size=2>));</font>
<br><font size=2 color=#008000>// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;if (!*(aKeyBinding[2])) return E_OUTOFMEMORY;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; *aNumBinding = 3L;</font>
<br><font size=2>&nbsp; </font><font size=2 color=blue>return</font><font size=2>
S_OK;</font>
<br><font size=2>}</font>
<br>
<br>
<br>
<br><font size=2 face="Arial">Brian Cragun</font>
<br><font size=2 face="Arial">IBM AbilityLab Consultant<br>
Human Ability &amp; Accessibility Center</font><font size=2 color=blue face="Arial"><u><br>
</u></font><a href=http://www.ibm.com/able><font size=2 color=blue face="Arial"><u>www.ibm.com/able</u></font></a><font size=2 face="Arial">
&amp; </font><a href=http://w3.ibm.com/able><font size=2 color=blue face="Arial"><u>w3.ibm.com/able</u></font></a>
<br><font size=2 face="Arial">W:(720)-663-2801 &nbsp; &nbsp;H:(507)288-2437</font>
<br>
<br><font size=2 face="Arial"><b><i>Subscribe to RSS feed and contribute
to</i></b></font><a href="http://w3.ibm.com/connections/communities/service/html/communityview?communityUuid=136047f0-6cda-4a2a-9a90-2188047a542a"><font size=2 color=blue face="Arial"><b><i>Accessibility
News community</i></b></font></a><font size=2 face="Arial"><b><i>on Connections</i></b></font>
<br><a href=http://www.facebook.com/IBMAccessibility><font size=2 color=blue face="Palatino Linotype"><u>IBM
Accessibility</u></font></a><font size=2 face="Palatino Linotype"> on Facebook
</font><font size=2 face="Arial">$B"'(B</font><font size=2 face="Arial"> </font><a href=http://twitter.com/IBMAccess><font size=2 color=blue face="Palatino Linotype"><u>IBMAccess</u></font></a><font size=2 face="Palatino Linotype">
on Twitter </font><font size=2 face="Arial">$B"'(B</font><font size=2 face="Arial">
</font><a href=http://www.linkedin.com/e/vgh/2419815/><font size=2 color=blue face="Palatino Linotype"><u>IBM
Accessibility</u></font></a><font size=2 face="Palatino Linotype"> on LinkedIn</font><font size=2 face="Arial"><br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">From:</font>
<td><font size=1 face="sans-serif">Brian Cragun/Rochester/IBM@IBMUS</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font>
<td><font size=1 face="sans-serif">accessibility@lists.linux-foundation.org</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font>
<td><font size=1 face="sans-serif">02/22/2010 01:52 PM</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font>
<td><font size=1 face="sans-serif">[Accessibility] Newbie question: help
with BSTR arrays</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Sent by:</font>
<td><font size=1 face="sans-serif">accessibility-bounces@lists.linux-foundation.org</font></table>
<br>
<hr noshade>
<br>
<br>
<br><font size=2 face="sans-serif">I'm struggling to understand how a BSTR
array is properly allocated and content is added to it. &nbsp; Also how
the BSTRs in the array are retrieved. &nbsp; Does anyone have any simple
examples?</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
The information at </font><a href=http://accessibility.freestandards.org/a11yspecs/ia2/docs/html/_generalinfo.html#_arrayConsideration><font size=2 color=blue face="sans-serif"><u>http://accessibility.freestandards.org/a11yspecs/ia2/docs/html/_generalinfo.html#_arrayConsideration</u></font></a><font size=2 face="sans-serif">
is useful but not quite enough for me.</font><font size=3> </font><font size=2 face="sans-serif"><br>
I assume I need to allocation the memory with </font><font size=3><b>CoTaskMemAlloc</b>
</font><font size=2 face="sans-serif">and release it with </font><font size=3><b>CoTaskMemFree.
&nbsp; </b><br>
<b><br>
Thanks!</b> <br>
<b><br>
- Brian</b> <br>
</font><font size=2 face="Arial"><br>
Brian Cragun</font><font size=3> </font><font size=2 face="Arial"><br>
IBM AbilityLab Consultant<br>
Human Ability &amp; Accessibility Center</font><font size=3 color=blue><u><br>
</u></font><a href=http://www.ibm.com/able><font size=2 color=blue face="Arial"><u>www.ibm.com/able</u></font></a><font size=2 face="Arial">
&amp; </font><a href=http://w3.ibm.com/able><font size=2 color=blue face="Arial"><u>w3.ibm.com/able</u></font></a><font size=3>
</font><font size=2 face="Arial"><br>
W:(720)-663-2801 &nbsp; &nbsp;H:(507)288-2437</font><font size=3> <br>
</font><tt><font size=2>_______________________________________________<br>
Accessibility mailing list<br>
Accessibility@lists.linux-foundation.org<br>
</font></tt><a href="https://lists.linux-foundation.org/mailman/listinfo/accessibility"><tt><font size=2>https://lists.linux-foundation.org/mailman/listinfo/accessibility</font></tt></a><tt><font size=2><br>
</font></tt>
<br>