示例#1
0
文件: ComboBox.cs 项目: mind0n/hive
            private void WmGetObject(ref Message m) {

                // See "How to Handle WM_GETOBJECT" in MSDN
                //
                if (NativeMethods.OBJID_CLIENT == unchecked((int)(long)m.LParam)) {

                    // 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;
                        UnsafeNativeMethods.IAccessibleInternal iacc = null;


                        if (_accessibilityObject == null) {
                            IntSecurity.UnmanagedCode.Assert();
                            try {
                                wfAccessibleObject = new ChildAccessibleObject(_owner, Handle);
                                _accessibilityObject = new InternalAccessibleObject(wfAccessibleObject);
                            }
                            finally {
                                CodeAccessPermission.RevertAssert();
                            }
                        }
                        iacc = (UnsafeNativeMethods.IAccessibleInternal)_accessibilityObject;

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

                        IntSecurity.UnmanagedCode.Assert();
                        try {
                            m.Result = UnsafeNativeMethods.LresultFromObject(ref IID_IAccessible, m.WParam, new HandleRef(this, punkAcc));
                        }
                        finally {
                            CodeAccessPermission.RevertAssert();
                            Marshal.Release(punkAcc);
                        }
                    }
                    catch (Exception e) {
                        throw new InvalidOperationException(SR.GetString(SR.RichControlLresult), e);
                    }
                }
                else {  // m.lparam != OBJID_CLIENT, so do default message processing
                    DefWndProc(ref m);
                }
            }
 public ToolStripComboBoxControlAccessibleObject(ToolStripComboBoxControl toolStripComboBoxControl)
     : base(toolStripComboBoxControl)
 {
     _childAccessibleObject = new ChildAccessibleObject(toolStripComboBoxControl, toolStripComboBoxControl.InternalHandle);
 }