コード例 #1
0
            internal void DisconnectChildren()
            {
                Debug.Assert(OsVersion.IsWindows8OrGreater);
                if (_rowsAccessibleObjects == null)
                {
                    return;
                }

                foreach (CalendarRowAccessibleObject row in _rowsAccessibleObjects)
                {
                    row.DisconnectChildren();
                    HRESULT result = UiaCore.UiaDisconnectProvider(row);
                    Debug.Assert(result == 0);
                }
            }
コード例 #2
0
            internal void DisconnectChildren()
            {
                Debug.Assert(OsVersion.IsWindows8OrGreater);
                if (_calendarHeaderAccessibleObject is not null)
                {
                    HRESULT result = UiaCore.UiaDisconnectProvider(_calendarHeaderAccessibleObject);
                    Debug.Assert(result == 0);
                }

                if (_calendarBodyAccessibleObject is not null)
                {
                    _calendarBodyAccessibleObject.DisconnectChildren();
                    HRESULT result = UiaCore.UiaDisconnectProvider(_calendarBodyAccessibleObject);
                    Debug.Assert(result == 0);
                }
            }
コード例 #3
0
            private void WmGetObject(ref Message m)
            {
                if (m.LParamInternal == NativeMethods.UiaRootObjectId)
                {
                    // If the requested object identifier is UiaRootObjectId,
                    // we should return an UI Automation provider using the UiaReturnRawElementProvider function.
                    m.ResultInternal = UiaCore.UiaReturnRawElementProvider(
                        this,
                        m.WParamInternal,
                        m.LParamInternal,
                        GetChildAccessibleObject(_childWindowType));

                    return;
                }

                // See "How to Handle WM_GETOBJECT" in MSDN
                if ((int)m.LParamInternal == OBJID.CLIENT)
                {
                    // Get the IAccessible GUID
                    Guid IID_IAccessible = new Guid(NativeMethods.uuid_IAccessible);

                    // Get an Lresult for the accessibility Object for this control
                    try
                    {
                        // Obtain the Lresult
                        IntPtr pUnknown = Marshal.GetIUnknownForObject(GetChildAccessibleObject(_childWindowType));

                        try
                        {
                            m.ResultInternal = Oleacc.LresultFromObject(ref IID_IAccessible, m.WParamInternal, new HandleRef(this, pUnknown));
                        }
                        finally
                        {
                            Marshal.Release(pUnknown);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new InvalidOperationException(SR.RichControlLresult, e);
                    }
                }
                else
                {  // m.lparam != OBJID_CLIENT, so do default message processing
                    DefWndProc(ref m);
                }
            }
コード例 #4
0
            internal void DisconnectChildren()
            {
                Debug.Assert(OsVersion.IsWindows8OrGreater);
                if (_weekNumberCellAccessibleObject is not null)
                {
                    HRESULT result = UiaCore.UiaDisconnectProvider(_weekNumberCellAccessibleObject);
                    Debug.Assert(result == 0);
                }

                if (_cellsAccessibleObjects is null)
                {
                    return;
                }

                foreach (CalendarCellAccessibleObject cell in _cellsAccessibleObjects)
                {
                    HRESULT result = UiaCore.UiaDisconnectProvider(cell);
                    Debug.Assert(result == 0);
                }
            }
コード例 #5
0
            private void WmGetObject(ref Message m)
            {
                Debug.WriteLineIf(CompModSwitches.MSAA.TraceInfo, $"In WmGetObject, this = {GetType().FullName}, lParam = {m.LParamInternal}");

                if (m.Msg == (int)User32.WM.GETOBJECT && m.LParamInternal == NativeMethods.UiaRootObjectId)
                {
                    // If the requested object identifier is UiaRootObjectId,
                    // we should return an UI Automation provider using the UiaReturnRawElementProvider function.
                    m.ResultInternal = UiaCore.UiaReturnRawElementProvider(
                        this,
                        m.WParamInternal,
                        m.LParamInternal,
                        AccessibilityObject);

                    return;
                }

                // Some accessible object requested that we don't care about, so do default message processing.
                DefWndProc(ref m);
            }
コード例 #6
0
            private void WmGetObject(ref Message m)
            {
                Debug.WriteLineIf(CompModSwitches.MSAA.TraceInfo, "In WmGetObject, this = " + GetType().FullName + ", lParam = " + m.LParam.ToString());

                if (m.Msg == (int)User32.WM.GETOBJECT && m.LParam == (IntPtr)NativeMethods.UiaRootObjectId)
                {
                    // If the requested object identifier is UiaRootObjectId,
                    // we should return an UI Automation provider using the UiaReturnRawElementProvider function.
                    InternalAccessibleObject intAccessibleObject = new InternalAccessibleObject(AccessibilityObject);
                    m.Result = UiaCore.UiaReturnRawElementProvider(
                        new HandleRef(this, Handle),
                        m.WParam,
                        m.LParam,
                        intAccessibleObject);

                    return;
                }

                // some accessible object requested that we don't care about, so do default message processing
                DefWndProc(ref m);
            }
コード例 #7
0
            // This function should be called from a single place in the root of MonthCalendar object that already tests for availability of this API
            internal void DisconnectChildren()
            {
                Debug.Assert(OsVersion.IsWindows8OrGreater);
                if (_previousButtonAccessibleObject is not null)
                {
                    HRESULT result = UiaCore.UiaDisconnectProvider(_previousButtonAccessibleObject);
                    Debug.Assert(result == 0);
                }

                if (_nextButtonAccessibleObject is not null)
                {
                    HRESULT result = UiaCore.UiaDisconnectProvider(_nextButtonAccessibleObject);
                    Debug.Assert(result == 0);
                }

                if (_todayLinkAccessibleObject is not null)
                {
                    HRESULT result = UiaCore.UiaDisconnectProvider(_todayLinkAccessibleObject);
                    Debug.Assert(result == 0);
                }

                if (_focusedCellAccessibleObject is not null)
                {
                    HRESULT result = UiaCore.UiaDisconnectProvider(_focusedCellAccessibleObject);
                    Debug.Assert(result == 0);
                }

                if (_calendarsAccessibleObjects is null)
                {
                    return;
                }

                foreach (CalendarAccessibleObject calendarAccessibleObject in _calendarsAccessibleObjects)
                {
                    calendarAccessibleObject.DisconnectChildren();
                    HRESULT result = UiaCore.UiaDisconnectProvider(calendarAccessibleObject);
                    Debug.Assert(result == 0);
                }
            }
コード例 #8
0
            private void WmGetObject(ref Message m)
            {
                if (m.LParam == (IntPtr)NativeMethods.UiaRootObjectId)
                {
                    AccessibleObject uiaProvider = GetChildAccessibleObject(_childWindowType);

                    // If the requested object identifier is UiaRootObjectId,
                    // we should return an UI Automation provider using the UiaReturnRawElementProvider function.
                    InternalAccessibleObject internalAccessibleObject = new InternalAccessibleObject(uiaProvider);
                    m.Result = UiaCore.UiaReturnRawElementProvider(
                        new HandleRef(this, Handle),
                        m.WParam,
                        m.LParam,
                        internalAccessibleObject);

                    return;
                }

                // See "How to Handle WM_GETOBJECT" in MSDN
                //
                if (unchecked ((int)(long)m.LParam) == OBJID.CLIENT)
                {
                    // Get the IAccessible GUID
                    //
                    Guid IID_IAccessible = new Guid(NativeMethods.uuid_IAccessible);

                    // Get an Lresult for the accessibility Object for this control
                    //
                    IntPtr punkAcc;
                    try
                    {
                        AccessibleObject            wfAccessibleObject = null;
                        UiaCore.IAccessibleInternal iacc = null;

                        if (_accessibilityObject is null)
                        {
                            wfAccessibleObject   = GetChildAccessibleObject(_childWindowType);
                            _accessibilityObject = new InternalAccessibleObject(wfAccessibleObject);
                        }
                        iacc = (UiaCore.IAccessibleInternal)_accessibilityObject;

                        // Obtain the Lresult
                        //
                        punkAcc = Marshal.GetIUnknownForObject(iacc);

                        try
                        {
                            m.Result = Oleacc.LresultFromObject(ref IID_IAccessible, m.WParam, new HandleRef(this, punkAcc));
                        }
                        finally
                        {
                            Marshal.Release(punkAcc);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new InvalidOperationException(SR.RichControlLresult, e);
                    }
                }
                else
                {  // m.lparam != OBJID_CLIENT, so do default message processing
                    DefWndProc(ref m);
                }
            }
            private void WmGetObject(ref Message m)
            {
                if (m.LParam == (IntPtr)NativeMethods.UiaRootObjectId &&
                    // Managed UIAutomation providers are supplied for child list windows but not for the child edit window.
                    // Child list accessibility object provides all necessary patterns and UIAutomation notifications,
                    // so there is no need to native provider supplement.
                    // Child edit accessibility object has only partial support of edit box accessibility, most of the patterns
                    // and notifications for child edit window are supplied by native providers, so here is no need to
                    // override root UIA object for child edit window.
                    (_childWindowType == ChildWindowType.ListBox || _childWindowType == ChildWindowType.DropDownList))
                {
                    AccessibleObject uiaProvider = GetChildAccessibleObject(_childWindowType);

                    // If the requested object identifier is UiaRootObjectId,
                    // we should return an UI Automation provider using the UiaReturnRawElementProvider function.
                    InternalAccessibleObject internalAccessibleObject = new InternalAccessibleObject(uiaProvider);
                    m.Result = UiaCore.UiaReturnRawElementProvider(
                        new HandleRef(this, Handle),
                        m.WParam,
                        m.LParam,
                        internalAccessibleObject);

                    return;
                }

                // See "How to Handle WM_GETOBJECT" in MSDN
                //
                if (unchecked ((int)(long)m.LParam) == OBJID.CLIENT)
                {
                    // Get the IAccessible GUID
                    //
                    Guid IID_IAccessible = new Guid(NativeMethods.uuid_IAccessible);

                    // Get an Lresult for the accessibility Object for this control
                    //
                    IntPtr punkAcc;
                    try
                    {
                        AccessibleObject            wfAccessibleObject = null;
                        UiaCore.IAccessibleInternal iacc = null;

                        if (_accessibilityObject is null)
                        {
                            wfAccessibleObject   = GetChildAccessibleObject(_childWindowType);
                            _accessibilityObject = new InternalAccessibleObject(wfAccessibleObject);
                        }
                        iacc = (UiaCore.IAccessibleInternal)_accessibilityObject;

                        // Obtain the Lresult
                        //
                        punkAcc = Marshal.GetIUnknownForObject(iacc);

                        try
                        {
                            m.Result = Oleacc.LresultFromObject(ref IID_IAccessible, m.WParam, new HandleRef(this, punkAcc));
                        }
                        finally
                        {
                            Marshal.Release(punkAcc);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new InvalidOperationException(SR.RichControlLresult, e);
                    }
                }
                else
                {  // m.lparam != OBJID_CLIENT, so do default message processing
                    DefWndProc(ref m);
                }
            }