[Accessibility-ia2] QI/QS

James Teh jamie at jantrid.net
Fri Feb 20 03:59:56 PST 2009


Hi Pete,

This all seems fine, with a few possible exceptions:
*  I notice that you aren't allowing IDispatch on an IAccessible2 
object. Would it perhaps be desirable to optionally implement IDispatch 
for IAccessible2 objects?
* You wrote:
> • If the SID is IID_IAccessible and the IID is IID_IUnknown, IID_IDispatch, or IID_IAccessible,
> then return the IAccessible for the IAccessible object, otherwise return E_NOINTERFACE.
The requested interface should be returned, not always IAccessible.

I'm concerned that the considerable length of this description may be 
confusing to the uninitiated. Perhaps it could be simplified to a 
discussion of what services support what interfaces. Something like this:

--begin--
IAccessible2 provides several services, each with one or more interfaces.

QueryService() must be used to switch between services, as it may return 
a different object. The SID specifies the requested service, while the 
IID specifies the requested interface within that service. If the SID 
and IID specify an appropriate service and interface, the interface 
should be returned. If the SID specifies an unsupported service or the 
IID specifies an interface which is not provided by the requested 
service, E_NOINTERFACE should be returned.

QueryInterface() can be used to switch to different interfaces of the 
same service. The IID specifies the requested interface. If the 
requested interface is supported, it should be returned. If the IID 
specifies an interface which is not provided by the current service, 
E_NOINTERFACE should be returned.

The IServiceProvider (IID_IServiceProvider) and IUnknown (IID_IUnknown) 
interfaces should be supported by all services. Optionally, the 
IDispatch interface (IID_IDispatch) may be supported by a service.

Following is a summary of the services and the interfaces (other than 
the basic interfaces above) they provide:
IID_IAccessible service: IAccessible (IID_IAccessible)
IID_IAccessible2 service: All IAccessible2 interfaces except 
IAccessibleApplication
IID_IAccessibleApplication service: IAccessibleApplication 
(IID_IAccessibleApplication) only
--end--

It is possible that I am misunderstanding how some of this stuff works; 
I'm definitely a bit of a novice at this COM stuff. :)

The advantage of my proposed text (assuming it's correct) is that it 
attempts to describe how QueryInterface() and QueryService() should 
work, followed by a summary of which services support which interfaces. 
(Admittedly, the former could be read in MSDN, although I always found 
the docs a bit confusing.) This makes it simpler to figure out *why* the 
functions should return what they do. The advantage of yours is that 
it's more algorithmic; you could translate it into a conditional with 
relative ease.

Feel free to throw it out the window. :) I'm not attached to this 
particular text, but I'd like to hear others' thoughts with regard to 
whether this needs to be simplified a bit or whether I'm just slightly 
braindead.

On 14/02/2009 9:32 AM, Pete Brunet wrote:
> Thanks Mick, IAccessible is defined to derive from IDispatch but
> although IAccessible2 currently derives from IAccessible, it should not
> have. This is a documented error. When that is eventually fixed
> IAccessible2 would only derive from IUnknown. So you should not be able
> to QI from IAccessible2 to IAccessible or IDispatch.
>
> All, Please review the following update. Also I have a question at the
> bottom.
>
> *QI & QS in the IAccessible2 object*
>
> QueryInterface
>
>     * If the IID is IID_IUnknown or the IID of any of the IA2 interfaces
>       except IAApplication then return the requested interface for the
>       IA2 object.
>     * If the IID is IID_IServiceProvider, return the IServiceProvider
>       interface for the service provider object.
>     * If the IID is IID_IEnumVariant, return the IEnumVariant interface
>       for the object imlementing it.
>     * If the IID is the one for IAccessible, IDispatch,
>       IAccessibleApplication, or any other IID return E_NOINTERFACE.
>
>
> QueryService
>
>     * If the SID is IID_IAccessible and the IID is IID_IUnknown,
>       IID_IDispatch, or IID_IAccessible, then return the requested
>       interface for the IAccessible object, otherwise return E_NOINTERFACE.
>     * If the SID is IID_IAccessible2 and the IID is IID_IUnknown or the
>       IID for any of the IA2 interfaces except IAApplication then return
>       the requested interface for the IA2 object, otherwise return
>       E_NOINTERFACE.
>     * If the SID is IID_IAccessibleApplication and the IID is
>       IID_IAcessibleApplication then return the IAcessibleApplication
>       interface, otherwise return E_NOINTERFACE.
>
>
> *QI & QS in the IAccessibleApplication object*
>
> QueryInterface
>
>     * If the IID is IID_IUnknown return the IUnknown interface for the
>       same object.
>     * If the IID is IID_IServiceProvider, return the IServiceProvider
>       interface for the service provider object.
>     * Otherwise return E_NOINTERFACE.
>
>
> QueryService
>
>     * If the SID is IID_IAccessible and the IID is IID_IUnknown,
>       IID_IDispatch, or IID_IAccessible, then return the IAccessible for
>       the IAccessible object, otherwise return E_NOINTERFACE.
>     * If the SID is IID_IAccessible2 and the IID is IID_IUnknown or the
>       IID for any of the IA2 interfaces except IAApplication then return
>       the requested interface for the IA2 object, otherwise return
>       E_NOINTERFACE.
>     * If the SID is IID_IAccessibleApplication and the IID is
>       IID_IAcessibleApplication then return the IAcessibleApplication
>       interface for the same object, else return E_NOINTERFACE.
>
> *
> QI & QS in the IAccessible object*
>
> QueryInterface
>
>     * If the IID is IAccessible2, return E_NOINTERFACE.
>
>
> QueryService
>
>     * If the SID is IID_IAccessible2 and the IID is IID_IUnknown or any
>       of the IA2 interfaces then return the requested interface, else
>       return E_NOINTEFACE.
>
>
> Should this final QS only respond to IID_IAccessible2 or should it
> respond to any of the IA2 IIDs?
>
> *Pete Brunet*
>
> IBM Accessibility Architecture and Development
> 11501 Burnet Road, MS 9022E004, Austin, TX 78758
> Voice: (512) 286-5485, Cell: (512) 689-4155
> Ionosphere: WS4G

-- 
James Teh
Email/MSN Messenger/Jabber: jamie at jantrid.net
Web site: http://www.jantrid.net/


More information about the Accessibility-ia2 mailing list