IAccessible::get_accDefaultAction
The IAccessible::get_accDefaultAction method retrieves a string that describes the object's default action. Not all objects have a default action.
HRESULT get_accDefaultAction(
VARIANTvarID,BSTR* pszDefaultAction);
Parameters
- varID
[in] Specifies whether the default action retrieved is that of the object or of one of the object's child elements. This parameter is either CHILDID_SELF (to obtain information about the object) or a child ID (to obtain information about the object's child element). For more information about initializing the VARIANT structure, see How Child IDs Are Used in Parameters. - pszDefaultAction
[out, retval] Address of a BSTR that receives a localized string that describes the default action for the specified object, or NULL if this object has no default action.
Return Values
If successful, returns S_OK.
If not successful, returns one of the following values or another standard COM error code. Although servers return these values, clients must always check output parameters to ensure that they contain valid values. For more information, see Checking IAccessible Return Values.
Error | Description |
---|---|
S_FALSE | The specified object does not have a default action. |
E_INVALIDARG | An argument is invalid. |
DISP_E_MEMBERNOTFOUND | The specified object does not support this property. |
Remarks
The retrieved string describes the action that is performed on an object, not what the object does as a result. For example, a toolbar button that prints a document has a default action of "Press" rather than "Prints the current document."
Do not confuse an object's default action with its value. For more information, see DefaultAction Property.
Only controls that perform actions support this method.
Note to server developers Localize the string returned from this property.
Server Example
The following example code shows a possible implementation of this method for a custom list box. For simplicity, the strings are not localized.
HRESULT STDMETHODCALLTYPE AccServer::get_accDefaultAction( VARIANT varChild, BSTR *pszDefaultAction) { if (varChild.vt != VT_I4) { *pszDefaultAction = NULL; return E_INVALIDARG; } if (varChild.lVal == CHILDID_SELF) { *pszDefaultAction = SysAllocString(L"None."); } else { *pszDefaultAction = SysAllocString(L"Double-click"); } return S_OK; };
Requirements
** Windows NT/2000/XP/Server 2003:** Included in Windows 2000 and later.
** Windows 95/98/Me:** Included in Windows 98 and later.
** Redistributable:** Requires Active Accessibility 1.3 RDK on Windows NT 4.0 SP6 and Windows 95.
** Header:** Declared in Oleacc.h.
** Library:** Use Oleacc.lib.
See Also
IAccessible::accDoDefaultAction, VARIANT Structure, DefaultAction Property