Using Server Annotation

This topic provides information about using server annotation to specify a callback object.

To override a property that specifies a callback object

  1. Obtain an IAccessible interface pointer to the accessible element that is to be annotated.
  2. Call QueryInterface on the accessible element to get an IAccIdentity interface pointer.
  3. Call IAccIdentity::GetIdentityString() on the IAccIdentity interface pointer to obtain a string that uniquely identifies the accessible element that is to be annotated.
  4. Use CoCreateInstance or CoCreateInstanceEx to create the IAccPropServices object.
  5. Create a Component Object Model (COM) object that implements IAccPropServer.
  6. Call IAccPropServices::SetPropServer, passing the identity string, a GUID indicating the property to be overridden, and a pointer to the IAccPropServer callback object.
  7. Release interface pointers and free memory.

When a client requests the property of the accessible element, the callback object will be called and will return the value to the client.

As when specifying a value, server developers can alternatively use the IAccPropServices::ComposeHwndIdentityString method to obtain an identity string; or they can use the IAccPropServices::SetHwndPropServer method and specify the hwnd, idObject, or idChild parameters instead of an identity string.

When using either SetPropServer or SetHwndPropServer on a container object, server developers can optionally specify that the overriding information should also apply to all element children of that container.

Servers can explicitly clear the annotation at any time by using IAccPropServices::ClearProps. This is usually not required, as the annotation service will automatically clean up and release annotation information when the accessible element being annotated disappears.

Below is a list of properties that can be annotated using this procedure.

Properties Supported When Specifying a Callback

When specifying a callback, the following properties can be annotated. Currently these properties cannot be annotated directly by specifying a value.

Property Type
PROPID_ACC_NAME VT_BSTR
PROPID_ACC_DESCRIPTION VT_BSTR
PROPID_ACC_ROLE VT_I4
PROPID_ACC_STATE VT_I4
PROPID_ACC_HELP VT_BSTR
PROPID_ACC_KEYBOARDSHORTCUT VT_BSTR
PROPID_ACC_DEFAULTACTION VT_BSTR
PROPID_ACC_VALUEMAP VT_BSTR
PROPID_ACC_ROLEMAP VT_BSTR
PROPID_ACC_STATEMAP VT_BSTR
PROPID_ACC_FOCUS VT_DISPATCH
VT_I4
PROPID_ACC_SELECTION VT_DISPATCH
VT_I4
VT_UNKNOWN
PROPID_ACC_PARENT VT_DISPATCH
PROPID_ACC_NAV_UP VT_DISPATCH
VT_I4
PROPID_ACC_NAV_DOWN VT_DISPATCH
VT_I4
PROPID_ACC_NAV_LEFT VT_DISPATCH
VT_I4
PROPID_ACC_NAV_RIGHT VT_DISPATCH
VT_I4
PROPID_ACC_NAV_PREV VT_DISPATCH
VT_I4
PROPID_ACC_NAV_NEXT VT_DISPATCH
VT_I4
PROPID_ACC_NAV_FIRSTCHILD VT_DISPATCH
VT_I4
PROPID_ACC_NAV_LASTCHILD VT_DISPATCH
VT_I4