Exemplo n.º 1
0
        bool UnsafeNativeMethods.IMsoComponentManager.FRegisterComponent(UnsafeNativeMethods.IMsoComponent component, System.Windows.Forms.NativeMethods.MSOCRINFOSTRUCT pcrinfo, out IntPtr dwComponentID)
        {
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }
            dwComponentID = IntPtr.Zero;
            if ((this._refCount == 0) && !this._original.FRegisterComponent(this, pcrinfo, out this._componentId))
            {
                return(false);
            }
            this._refCount++;
            if (this._components == null)
            {
                this._components = new Dictionary <int, UnsafeNativeMethods.IMsoComponent>();
            }
            this._nextComponentId++;
            if (this._nextComponentId == 0x7fffffff)
            {
                this._nextComponentId = 1;
            }
            bool flag = false;

            while (this._components.ContainsKey(this._nextComponentId))
            {
                this._nextComponentId++;
                if (this._nextComponentId == 0x7fffffff)
                {
                    if (flag)
                    {
                        throw new InvalidOperationException(System.Windows.Forms.SR.GetString("ComponentManagerProxyOutOfMemory"));
                    }
                    flag = true;
                    this._nextComponentId = 1;
                }
            }
            this._components.Add(this._nextComponentId, component);
            dwComponentID = (IntPtr)this._nextComponentId;
            return(true);
        }
Exemplo n.º 2
0
 bool UnsafeNativeMethods.IMsoComponentManager.FUpdateComponentRegistration(IntPtr dwComponentID, System.Windows.Forms.NativeMethods.MSOCRINFOSTRUCT info)
 {
     if (this._original == null)
     {
         return(false);
     }
     return(this._original.FUpdateComponentRegistration(this._componentId, info));
 }
Exemplo n.º 3
0
 bool UnsafeNativeMethods.IMsoComponentManager.FGetActiveComponent(int dwgac, UnsafeNativeMethods.IMsoComponent[] ppic, System.Windows.Forms.NativeMethods.MSOCRINFOSTRUCT info, int dwReserved)
 {
     if (this._original == null)
     {
         return(false);
     }
     if (!this._original.FGetActiveComponent(dwgac, ppic, info, dwReserved))
     {
         return(false);
     }
     if (ppic[0] == this)
     {
         if (dwgac == 0)
         {
             ppic[0] = this._activeComponent;
         }
         else if (dwgac == 1)
         {
             ppic[0] = this._trackingComponent;
         }
         else if ((dwgac == 2) && (this._trackingComponent != null))
         {
             ppic[0] = this._trackingComponent;
         }
     }
     return(ppic[0] != null);
 }