private void SetAccessibleProperties() { //Here we are consuming the COM Exceptions which happens in case //the property/Method we need is not available with IAccessible Object. try { _name = _accessible.get_accName(0); } catch (Exception ex) { } try { _value = _accessible.get_accValue(0); } catch (Exception ex) { } try { uint stateId = Convert.ToUInt32(_accessible.get_accState(0)); _state = MSAA.GetStateText(stateId); } catch (Exception ex) { } try { uint roleId = Convert.ToUInt32(_accessible.get_accRole(0)); _role = MSAA.GetRoleText(roleId); } catch (Exception ex) { } _handle = MSAA.GetHandle(_accessible); try { _defaultAction = _accessible.get_accDefaultAction(0); } catch (Exception ex) { } SetLocation(_accessible); }
string?IAccessibleInternal.get_accDefaultAction(object childID) => publicIAccessible.get_accDefaultAction(childID);
private static string GetDefaultAction(IAccessible acc, int idChild) { try { return FixBstr(acc.get_accDefaultAction(idChild)); } catch (Exception e) { if (HandleIAccessibleException(e)) { throw; } return ""; } }
string UnsafeNativeMethods.IAccessibleInternal.get_accDefaultAction(object childID) { IntSecurity.UnmanagedCode.Assert(); return(publicIAccessible.get_accDefaultAction(childID)); }