Пример #1
0
 public static extern HRESULT SHGetImageList(int iImageList, ref Guid riid, out IImageList ppv);
Пример #2
0
 public static extern int SHGetImageList(
     int iImageList,
     ref Guid riid,
     ref IImageList ppv
     );
Пример #3
0
 /// <summary>
 /// Gets the image list handle.
 /// </summary>
 /// <param name="imageList">The image list.</param>
 /// <returns>The image list handle for the image list.</returns>
 private static IntPtr GetImageListHandle(IImageList imageList)
 {
     return Marshal.GetIUnknownForObject(imageList);
 }
Пример #4
0
 public static extern int SHGetImageList(
     int imageList,
     ref Guid riid,
     ref IImageList ppv);
 private extern static int SHGetImageList(
     int iImageList,
     ref Guid riid,
     ref IImageList ppv
     );
Пример #6
0
 private static extern int SHGetImageList(
     int iImageList,
     ref Guid riid,
     out IImageList ppv);
Пример #7
0
        }// Initialize

        //-------------------------------------------------
        // Notify
        //
        // This is where most of the interesting stuff happens.
        // Whenever MMC needs something from the snapin, it will
        // send a message to Notify, and notify is responsible
        // to take care (or delegate) whatever MMC wants
        //-------------------------------------------------
        public int Notify(IntPtr lpDataObject, uint aevent, IntPtr arg, IntPtr param)
        {
            // We don't handle any of the special data objects here
            if (lpDataObject == (IntPtr)DOBJ.CUSTOMOCX || lpDataObject == (IntPtr)DOBJ.CUSTOMWEB)
            {
                return(HRESULT.S_FALSE);
            }

            IDataObject ido = null;

            if (lpDataObject != (IntPtr)0)
            {
                ido = (IDataObject)Marshal.GetObjectForIUnknown(lpDataObject);
            }

            CDO Data; // This will hold the object MMC wants action performed on

            // lpDataObject is just a CDO... we're going to obtain the CDO interface.
            // if lpDataObject is null, then there needs to be action performed on the root
            // node.
            if (ido != null)
            {
                Data = (CDO)ido;
            }
            else
            {
                CNode node = CNodeManager.GetNode(CNodeManager.RootNodeCookie);
                Data = new CDO(node);
            }

            switch (aevent)
            {
            // The user clicked the 'forward' or 'back' button on the MMC browser.
            // We need to sync up our node to the new result view
            case MMCN.RESTORE_VIEW:
                return(Data.Node.onRestoreView((MMC_RESTORE_VIEW)Marshal.PtrToStructure(arg, typeof(MMC_RESTORE_VIEW)), param));


            // We're being asked if we will accept an item to be pasted
            // (Used here to tell MMC if this node is a valid drag-and-drop
            // location)
            case MMCN.QUERY_PASTE:
                // See if it's asking about result items or scope items
                return(Data.Node.doAcceptPaste((IDataObject)Marshal.GetObjectForIUnknown((IntPtr)arg)));

            // We're being given an item to paste. (Used here to tell MMC that
            // something is being dropped here from a drag and drop operation)
            case MMCN.PASTE:
                return(Data.Node.Paste((IDataObject)Marshal.GetObjectForIUnknown((IntPtr)arg)));

            // The selected item needs to show something in the result pane
            case MMCN.SHOW:
                // If we're selecting this item
                if ((uint)arg == 1)
                {
                    CNodeManager.SelectedNode = Data.Node;
                }
                Data.Node.onShow(m_ucsole, arg, param);
                break;

            // If an item is selected, we should set flags for verbs available
            // for the item (from the dropdown menu)
            case MMCN.SELECT:

                bool fEnablePropPages = false;
                // See if this is selected from the result view
                if (((uint)arg & 0x0000FFFF) == 0)
                {
                    // See if we selected it or de-selected it
                    if (((uint)arg & 0xFFFF0000) == 0)
                    {
                        Data.Node.ResultItemUnSelected(m_ucsole, Data.Data);
                    }
                    else
                    {
                        Data.Node.ResultItemSelected(m_ucsole, Data.Data);
                    }


                    // Let's see if this result item has a property page
                    if (Data.Node.DoesResultHavePropertyPage(Data.Data))
                    {
                        fEnablePropPages = true;
                    }
                }
                // This item was selected in the scope view
                else
                if (Data.Node.HavePropertyPages)
                {
                    fEnablePropPages = true;
                }


                IConsoleVerb icv;
                // Get the IConsoleVerb interface from MMC
                m_ucsole.QueryConsoleVerb(out icv);

                // See if we need to enable then property sheets item on the popup menu
                if (fEnablePropPages)
                {
                    icv.SetVerbState(MMC_VERB.PROPERTIES, MMC_BUTTON_STATE.ENABLED, 1);
                }
                else
                {
                    icv.SetVerbState(MMC_VERB.PROPERTIES, MMC_BUTTON_STATE.ENABLED, 0);
                }


                // We'll only call this onSelect method if the user selected the
                // scope item
                if (((uint)arg & 0x0000FFFF) > 0 && ((uint)arg & 0xFFFF0000) > 0)
                {
                    icv.SetVerbState(MMC_VERB.PASTE, MMC_BUTTON_STATE.ENABLED, 1);
                    Data.Node.onSelect(icv);
                }
                break;

            // This is to add images for the result pane
            case MMCN.ADD_IMAGES:
                // arg actually contains the IImageList interface. We need to tell
                // C# that it is a Object and not a integer.

                IImageList il = (IImageList)Marshal.GetObjectForIUnknown((IntPtr)arg);

                // param contains the HScopeItem. Let's get the node it represents
                CNode nLuckyGuy = CNodeManager.GetNodeByHScope((int)param);

                il.ImageListSetIcon(nLuckyGuy.IconHandle, CResourceStore.GetIconCookie(nLuckyGuy.IconHandle));

                // Now add all the children images
                CNode nChild = null;
                for (int i = 0; i < nLuckyGuy.NumChildren; i++)
                {
                    nChild = CNodeManager.GetNode(nLuckyGuy.Child[i]);
                    il.ImageListSetIcon(nChild.IconHandle, CResourceStore.GetIconCookie(nChild.IconHandle));
                }

                // Now add any images that the node might have for it's listview
                if (nLuckyGuy.m_oResults != null && nLuckyGuy.m_oResults is IColumnResultView)
                {
                    ((IColumnResultView)nLuckyGuy.m_oResults).AddImages(ref il);
                }

                break;

            // The user double clicked on something
            case MMCN.DBLCLICK:
                return(Data.Node.onDoubleClick(Data.Data));

            case MMCN.DELETE:
                return(Data.Node.onDelete(Data.Data));

            default:
                // We don't support the Notification message we got
                return(HRESULT.S_FALSE);
            }
            return(HRESULT.S_OK);
        }// Notify
Пример #8
0
        /// <summary>
        /// Clears up any resources associated with the SystemImageList
        /// when disposing is true.
        /// </summary>
        /// <param name="disposing">Whether the object is being disposed</param>
        public virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    if (this.imageList != null)
                    {
                        Marshal.ReleaseComObject(this.imageList);
                    }

                    this.imageList = null;
                }
            }

            this.disposed = true;
        }
Пример #9
0
 /// <summary>
 /// Gets the image list handle.
 /// </summary>
 /// <param name="imageList">The image list.</param>
 /// <returns>The image list handle for the image list.</returns>
 private static IntPtr GetImageListHandle(IImageList imageList)
 {
     return(Marshal.GetIUnknownForObject(imageList));
 }
Пример #10
0
 private extern static int SHGetImageList(
     int iImageList,
     ref Guid riid,
     ref IImageList ppv
     );
Пример #11
0
 public static extern int SHGetImageList(SHIL iImageList, ref Guid riid, out IImageList ppv);
Пример #12
0
 public extern static HRESULT SHGetImageList(int iImageList, ref Guid riid, out IImageList ppv);
Пример #13
0
 public extern static int SHGetImageList(int iImageList, ref Guid riid, out IImageList ppv);
 /// <summary>
 /// Clears up any resources associated with the SystemImageList
 /// when disposing is true.
 /// </summary>
 /// <param name="disposing">Whether the object is being disposed</param>
 public virtual void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             if (iImageList != null)
             {
                 System.Runtime.InteropServices.Marshal.ReleaseComObject(iImageList);
             }
             iImageList = null;
         }
     }
     disposed = true;
 }
Пример #15
0
 internal extern static int SHGetImageList(int iImageList, ref Guid riid, out IImageList ppv);
        private static extern int SHGetImageList(
			int iImageList,
			ref System.Guid riid,
			ref IImageList ppv
			);
Пример #17
0
 public static extern int SHGetImageList(uint iImageList, [MarshalAs(UnmanagedType.LPStruct)] Guid riid, out IImageList ppv);
Пример #18
0
 private static extern int SHGetImageList(
     int imageList,
     ref Guid riid,
     ref IImageList ppv);
Пример #19
0
 public void LoadSettings(IImageList input)
 {
     tuner.SetSnapshotCount(1, input?.Count ?? 1);
 }
 /// <summary>
 /// Clears up any resources associated with the SystemImageList
 /// when disposing is true.
 /// </summary>
 /// <param name="disposing">Whether the object is being disposed</param>
 public virtual void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             if (iImageList != null)
             {
                 Marshal.ReleaseComObject(iImageList);
             }
             iImageList = null;
         }
     }
     disposed = true;
 }
Пример #21
0
        }// getValues

        public override void AddImages(ref IImageList il)
        {
            il.ImageListSetIcon(m_hGACIcon, m_iGACIconIndex);
        }// AddImages