Пример #1
0
 int UnsafeNativeMethods.IOleContainer.EnumObjects(int grfFlags, out UnsafeNativeMethods.IEnumUnknown ppenum) {
     ppenum = null;
     if ((grfFlags & 1) != 0) { // 1 == OLECONTF_EMBEDDINGS
         Debug.Assert(parent != null, "gotta have it...");
         ArrayList list = new ArrayList();
         ListAXControls(list, true);
         if (list.Count > 0) {
             Object[] temp = new Object[list.Count];
             list.CopyTo(temp, 0);
             ppenum = new AxHost.EnumUnknown(temp);
             return NativeMethods.S_OK;
         }
     }
     ppenum = new AxHost.EnumUnknown(null);
     return NativeMethods.S_OK;
 }
 int UnsafeNativeMethods.IOleContainer.EnumObjects(int grfFlags, out UnsafeNativeMethods.IEnumUnknown ppenum)
 {
     ppenum = null;
     if ((grfFlags & 1) != 0)
     {
         ArrayList list = new ArrayList();
         this.ListAXControls(list, true);
         if (list.Count > 0)
         {
             object[] array = new object[list.Count];
             list.CopyTo(array, 0);
             ppenum = new AxHost.EnumUnknown(array);
             return(0);
         }
     }
     ppenum = new AxHost.EnumUnknown(null);
     return(0);
 }
Пример #3
0
 int UnsafeNativeMethods.IOleContainer.EnumObjects(int grfFlags, out UnsafeNativeMethods.IEnumUnknown ppenum)
 {
     ppenum = null;
     if ((grfFlags & 1) != 0)   // 1 == OLECONTF_EMBEDDINGS
     {
         Debug.Assert(parent != null, "gotta have it...");
         ArrayList list = new ArrayList();
         ListAXControls(list, true);
         if (list.Count > 0)
         {
             object[] temp = new object[list.Count];
             list.CopyTo(temp, 0);
             ppenum = new AxHost.EnumUnknown(temp);
             return(NativeMethods.S_OK);
         }
     }
     ppenum = new AxHost.EnumUnknown(null);
     return(NativeMethods.S_OK);
 }
Пример #4
0
        HRESULT Ole32.IOleContainer.EnumObjects(Ole32.OLECONTF grfFlags, out Ole32.IEnumUnknown ppenum)
        {
            ppenum = null;
            if ((grfFlags & Ole32.OLECONTF.EMBEDDINGS) != 0)
            {
                Debug.Assert(parent is not null, "gotta have it...");
                ArrayList list = new ArrayList();
                ListAXControls(list, true);
                if (list.Count > 0)
                {
                    object[] temp = new object[list.Count];
                    list.CopyTo(temp, 0);
                    ppenum = new AxHost.EnumUnknown(temp);
                    return(HRESULT.S_OK);
                }
            }

            ppenum = new AxHost.EnumUnknown(null);
            return(HRESULT.S_OK);
        }
 void System.Windows.Forms.UnsafeNativeMethods.IEnumUnknown.Clone(out System.Windows.Forms.UnsafeNativeMethods.IEnumUnknown ppenum)
 {
     ppenum = new AxHost.EnumUnknown(this.arr, this.loc);
 }
 int System.Windows.Forms.UnsafeNativeMethods.IOleContainer.EnumObjects(int grfFlags, out System.Windows.Forms.UnsafeNativeMethods.IEnumUnknown ppenum)
 {
     ppenum = null;
     if ((grfFlags & 1) != 0)
     {
         ArrayList list = new ArrayList();
         this.ListAxControls(list, true);
         if (list.Count > 0)
         {
             object[] array = new object[list.Count];
             list.CopyTo(array, 0);
             ppenum = new AxHost.EnumUnknown(array);
             return 0;
         }
     }
     ppenum = new AxHost.EnumUnknown(null);
     return 0;
 }
            internal System.Windows.Forms.UnsafeNativeMethods.IEnumUnknown EnumControls(Control ctl, int dwOleContF, int dwWhich)
            {
                System.Windows.Forms.UnsafeNativeMethods.IEnumUnknown unknown;
                this.GetComponents();
                this.LockComponents();
                try
                {
                    AxHost.AxContainer container;
                    ArrayList l = null;
                    bool selected = (dwWhich & 0x40000000) != 0;
                    bool flag2 = (dwWhich & 0x8000000) != 0;
                    bool flag3 = (dwWhich & 0x10000000) != 0;
                    bool flag4 = (dwWhich & 0x20000000) != 0;
                    dwWhich &= -2013265921;
                    if (flag3 && flag4)
                    {
                        throw AxHost.E_INVALIDARG;
                    }
                    if (((dwWhich == 2) || (dwWhich == 3)) && (flag3 || flag4))
                    {
                        throw AxHost.E_INVALIDARG;
                    }
                    int num = 0;
                    int tabIndex = -1;
                    Control[] array = null;
                    switch (dwWhich)
                    {
                        case 1:
                        {
                            Control parentInternal = ctl.ParentInternal;
                            if (parentInternal == null)
                            {
                                goto Label_00E2;
                            }
                            array = parentInternal.GetChildControlsInTabOrder(false);
                            if (!flag4)
                            {
                                break;
                            }
                            tabIndex = ctl.TabIndex;
                            goto Label_00EA;
                        }
                        case 2:
                            l = new ArrayList();
                            this.MaybeAdd(l, ctl, selected, dwOleContF, false);
                            goto Label_0128;

                        case 3:
                            array = ctl.GetChildControlsInTabOrder(false);
                            ctl = null;
                            goto Label_015F;

                        case 4:
                        {
                            Hashtable components = this.GetComponents();
                            array = new Control[components.Keys.Count];
                            components.Keys.CopyTo(array, 0);
                            ctl = this.parent;
                            goto Label_015F;
                        }
                        default:
                            throw AxHost.E_INVALIDARG;
                    }
                    if (flag3)
                    {
                        num = ctl.TabIndex + 1;
                    }
                    goto Label_00EA;
                Label_00E2:
                    array = new Control[0];
                Label_00EA:
                    ctl = null;
                    goto Label_015F;
                Label_0102:
                    container = FindContainerForControl(ctl);
                    if (container == null)
                    {
                        goto Label_015F;
                    }
                    this.MaybeAdd(l, container.parent, selected, dwOleContF, true);
                    ctl = container.parent;
                Label_0128:
                    if (ctl != null)
                    {
                        goto Label_0102;
                    }
                Label_015F:
                    if (l == null)
                    {
                        l = new ArrayList();
                        if ((tabIndex == -1) && (array != null))
                        {
                            tabIndex = array.Length;
                        }
                        if (ctl != null)
                        {
                            this.MaybeAdd(l, ctl, selected, dwOleContF, false);
                        }
                        for (int i = num; i < tabIndex; i++)
                        {
                            this.MaybeAdd(l, array[i], selected, dwOleContF, false);
                        }
                    }
                    object[] objArray = new object[l.Count];
                    l.CopyTo(objArray, 0);
                    if (flag2)
                    {
                        int index = 0;
                        for (int j = objArray.Length - 1; index < j; j--)
                        {
                            object obj2 = objArray[index];
                            objArray[index] = objArray[j];
                            objArray[j] = obj2;
                            index++;
                        }
                    }
                    unknown = new AxHost.EnumUnknown(objArray);
                }
                finally
                {
                    this.UnlockComponents();
                }
                return unknown;
            }