Example #1
0
        private ResultDataItem GetNextResultItem(int index)
        {
            ResultDataItem rdi = new ResultDataItem();

            rdi.Mask  = (uint)ResultDataItemMask.State;
            rdi.Col   = 0;
            rdi.Index = index;
            IResultData resultData = Snapin.ResultViewConsole as IResultData;

            resultData.GetNextItem(ref rdi);
            return(rdi);
        }
Example #2
0
        internal ResultDataItem GetSelectedItem(IResultData resultData, int index)
        {
            ResultDataItem item = new ResultDataItem();

            item.Mask  = (uint)ResultDataItemFlags.State;
            item.Col   = 0;
            item.Index = index;
            item.State = (uint)ListViewItemState.Selected;

            try
            {
                resultData.GetNextItem(ref item);
            }
            catch (COMException)
            {
            }

            return(item);
        }
Example #3
0
        }// Destroy

        //-------------------------------------------------
        // QueryDataObject
        //
        // When MMC wants a data object for a specific cookie,
        // this function will be called.
        //-------------------------------------------------
        public void QueryDataObject(int cookie, uint type, out IDataObject ppDataObject)
        {
            // Our cookies for results are a little bit 'munged'
            // The low word is the actual cookie, while the high word is
            // the row # of the result item (1-based)

            // Crap.... we have a multi-selection to worry about
            if (cookie == MMC.MULTI_SELECT_COOKIE)
            {
                IResultData ResultData     = (IResultData)m_ucsole;
                ArrayList   al             = new ArrayList();
                bool        isLastSelected = false;
                int         nGoodCookie    = -1;
                int         nIndex         = -1;

                while (!isLastSelected)
                {
                    RESULTDATAITEM rdi = new RESULTDATAITEM();
                    rdi.mask   = RDI.STATE;
                    rdi.nCol   = 0;
                    rdi.nIndex = nIndex;
                    rdi.nState = LVIS.SELECTED;

                    ResultData.GetNextItem(ref rdi);

                    if (rdi.nIndex != -1)
                    {
                        al.Add((int)((rdi.lParam & 0xFFFF0000) >> 16));
                        nGoodCookie = rdi.lParam;
                        nIndex      = rdi.nIndex;
                    }
                    else
                    {
                        isLastSelected = true;
                    }
                }
                if (nGoodCookie != -1)
                {
                    int   iRealCookie = nGoodCookie & 0x0000FFFF;
                    CNode node        = CNodeManager.GetNode(iRealCookie);
                    CDO   cdo         = new CDO(node);
                    cdo.Data     = al;
                    ppDataObject = cdo;
                }
                else
                {
                    ppDataObject = null;
                }
            }
            else
            {
                int    iRealCookie = cookie & 0x0000FFFF;
                CNode  node        = CNodeManager.GetNode(iRealCookie);
                CDO    cdo         = new CDO(node);
                Object o;
                if (node.ResultQDO(cookie, out o))
                {
                    cdo.Data = o;
                }
                else
                {
                    cdo.Data = (int)((cookie & 0xFFFF0000) >> 16);
                }

                ppDataObject = cdo;
            }
        }// QueryDataObject