示例#1
0
        }// Command

        //-------------------------------------------------------
        // Stuff for IExtendPropertySheet2 - This will only be
        // called for stuff in the scope view
        //-------------------------------------------------------

        //-------------------------------------------------
        // CreatePropertyPages
        //
        // MMC calls this function when it wants a property
        // page for a specified node.
        //-------------------------------------------------
        public int CreatePropertyPages(IPropertySheetCallback lpProvider, IntPtr handle, IDataObject lpIDataObject)
        {
            // This is really a CDO in disguise
            CDO victim = (CDO)lpIDataObject;

            // See if I really need to do this....
            if (m_ucsole != null)
            {
                IPropertySheetProvider psp = (IPropertySheetProvider)m_ucsole;

                if (psp.FindPropertySheet(victim.Node.Cookie, null, victim) == HRESULT.S_OK)
                {
                    return(HRESULT.S_FALSE);
                }
            }
            // Let's see if this node has property pages
            if (victim.Node != null && victim.Node.HavePropertyPagesCreate)
            {
                // If we've fired up a wizard, then that command has already been
                // logged (either from the menu command or the history list command.
                // We don't need to record this any further.
                if (!(victim.Node is CWizard))
                {
                    CCommandHistory.CommandExecuted(victim, -1);
                }
                victim.Node.CreatePropertyPages(lpProvider, handle);

                return(HRESULT.S_OK);
            }
            // We don't have any property pages, let's return false
            else
            {
                return(HRESULT.S_FALSE);
            }
        }// CreatePropertyPages
示例#2
0
        }// OpenMyResultPropertyPage

        private void OpenPropertyPage(String sTitle, CDO cdo, Object o, int nScopeItem, bool fReallyOpen)
        {
            if (CNodeManager.FindPropertyPage(cdo) != HRESULT.S_OK && fReallyOpen)

            {
                // Note, doing this stuff will only work if called from the main MMC thread.
                // If it needs to be called from a helper thread or from a property page
                // thread then marshalling should be set up using the framework provided
                // in CNodeManager
                IPropertySheetProvider psp = (IPropertySheetProvider) new NodeManager();

                psp.CreatePropertySheet(sTitle, 1, Cookie, cdo, 0);
                psp.AddPrimaryPages(o, 1, 0, nScopeItem);
                psp.Show(IntPtr.Zero, 0);
            }
        }// OpenPropertyPage
示例#3
0
        }// CWizard

        internal void LaunchWizard(int nParentCookie)
        {
            m_nParentNodeCookie = nParentCookie;
            // Let's hook into all the property pages that are in our wizard
            for (int i = 0; i < m_aPropSheetPage.Length; i++)
            {
                m_aPropSheetPage[i].DialogProcHook = new DialogProc(PropPageDialogProc);
            }

            IPropertySheetProvider psp = (IPropertySheetProvider)CNodeManager.Console;

            psp.CreatePropertySheet("", 0, m_nCookie, new CDO(this), MMC_PSO.HASHELP | MMC_PSO.NEWWIZARDTYPE);
            psp.AddPrimaryPages(CNodeManager.Data, 1, 0, 1);

            m_hWnd = (IntPtr)0;
            CNodeManager.Console.GetMainWindow(out m_hWnd);
            psp.Show(m_hWnd, 0);
        }// Launch Wizard
        }// Init

        //---------------------------------------------------------------------------
        //  This is our hidden window which is just used for handling messages.  We
        //  go to all this trouble so that we don't ever pass interface pointers or
        //  other objects across threads.
        //
        static internal IntPtr NodeManagerMessageProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
        {
            SCOPEDATAITEM sdi;

            switch (uMsg)
            {
            case WM_NAMESPACEEXPAND:
                CNamespace.Expand((int)wParam);
                break;

            case WM_INSERTITEM:
                sdi = (SCOPEDATAITEM)Marshal.PtrToStructure(wParam, typeof(SCOPEDATAITEM));
                CNamespace.InsertItem(ref sdi);
                return((IntPtr)sdi.ID);

            case WM_SETITEM:
                sdi = (SCOPEDATAITEM)Marshal.PtrToStructure(wParam, typeof(SCOPEDATAITEM));
                CNamespace.SetItem(ref sdi);
                break;

            case WM_SELECTSCOPEITEM:
                CNodeManager.Console.SelectScopeItem((int)wParam);
                break;

            case WM_FINDPROPPAGE:
                IPropertySheetProvider psp = (IPropertySheetProvider) new NodeManager();
                CDO cdo = (CDO)Marshal.GetObjectForIUnknown(wParam);
                return((IntPtr)psp.FindPropertySheet(cdo.Node.Cookie, Component, cdo));

            case WM_SETCONSOLEICON:
                IImageList il = null;
                Console.QueryScopeImageList(out il);
                if (il != null)
                {
                    il.ImageListSetIcon(wParam, (int)lParam);
                }
                break;


            default:
                return(DefWindowProc(hWnd, uMsg, wParam, lParam));
            }
            return(IntPtr.Zero);
        }// NodeManagerMessageProc