コード例 #1
0
ファイル: ResultNode.cs プロジェクト: formist/LinkMe
        internal override void CreatePropertyForm(IPropertySheetCallback lpProvider, IntPtr handle)
        {
            if (IsSelected)
            {
                // The node is selected so delegate to the base.

                base.CreatePropertyForm(lpProvider, handle);
            }
            else if (IsResultSelected)
            {
                // Determine which result is selected.

                Result result = GetSelectedResults()[0];
                if (result != null)
                {
                    // Create the property sheet on a separate thread if it doesn't already exist.

                    if (result.PropertyForm == null)
                    {
                        ResultPropertyFormData data = new ResultPropertyFormData(result, this);
                        Thread thread = new Thread(data.CreateThreadResultPropertyForm);
                        thread.SetApartmentState(ApartmentState.STA);
                        thread.Start();
                    }
                    else
                    {
                        result.PropertyForm.Activate();
                    }
                }
            }
        }
コード例 #2
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
コード例 #3
0
ファイル: cnode.cs プロジェクト: wolewd/Windows-Server-2003
        }// CreatePropertyPages

        internal void CreateSinglePropertyPage(IPropertySheetCallback lpProvider, CPropPage ppage)
        {
            PROPSHEETPAGE psp = new PROPSHEETPAGE();
            IntPtr        hPage;

            // Fill in the property sheet page structure with the appropriate info
            psp.dwSize    = 48;
            psp.dwFlags   = PSP.DEFAULT | PSP.DLGINDIRECT | PSP.USETITLE | PSP.USEHEADERTITLE | PSP.USEHEADERSUBTITLE;
            psp.hInstance = m_hModule;
            // We're using just a plain resource file as a "placeholder" for our WFC
            // placed controls
            psp.pResource = ppage.GetDialogTemplate();

            psp.pszTitle          = ppage.Title();
            psp.hIcon             = ppage.Icon();
            psp.pszHeaderTitle    = ppage.HeaderTitle();
            psp.pszHeaderSubTitle = ppage.HeaderSubTitle();

            // See if our property page uses a icon
            if (psp.hIcon != (IntPtr)(-1))
            {
                psp.dwFlags |= PSP.USEHICON;
            }

            // See if our property page uses a title
            if (ppage.Title() != null)
            {
                psp.dwFlags |= PSP.USETITLE;
            }

            // See if the property page uses a header title
            if (psp.pszHeaderTitle != null)
            {
                psp.dwFlags |= PSP.USEHEADERTITLE;
            }

            // See if the property page uses a header subtitle
            if (psp.pszHeaderSubTitle != null)
            {
                psp.dwFlags |= PSP.USEHEADERSUBTITLE;
            }


            psp.pfnDlgProc = ppage.DialogProc;

            hPage = CreatePropertySheetPage(ref psp);

            // See if we were able to register the property page
            if (hPage == (IntPtr)0)
            {
                MessageBox("Couldn't create the property page", "", 0);
                throw new Exception("Unable to RegisterPropertyPage");
            }
            else
            {
                // Add the page to the property sheet
                lpProvider.AddPage(hPage);
            }
        }// CreateSinglePropertyPage
コード例 #4
0
ファイル: Component.cs プロジェクト: formist/LinkMe
        /// <summary>
        /// MMC wants a property sheet created of the given node
        /// </summary>
        public int CreatePropertyPages(IPropertySheetCallback lpProvider, IntPtr handle, IDataObject lpDataObject)
        {
            DataObject dataObject = (DataObject)lpDataObject;

            // Let's see if this node has property pages.

            dataObject.Node.CreatePropertyForm(lpProvider, handle);

            // Don't use the MMC property page facilities.

            return(Constants.Win32.HResults.S_FALSE);
        }
コード例 #5
0
ファイル: SnapinNode.cs プロジェクト: formist/LinkMe
        internal virtual void CreatePropertyForm(IPropertySheetCallback lpProvider, IntPtr handle)
        {
            // Create the property sheet on a separate thread if it doesn't already exist.

            if (m_propertyForm == null)
            {
                Thread thread = new Thread(new ThreadStart(CreatePropertyFormThread));
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            else
            {
                m_propertyForm.Activate();
            }
        }
コード例 #6
0
ファイル: cnode.cs プロジェクト: wolewd/Windows-Server-2003
        }// CreateResultPropertyPages

        //-------------------------------------------------
        // CreatePropertyPages
        //
        // This function will create property sheet pages based
        // on the information stored in its m_aPropSheetPage field.
        // It registers the property page along with the callback
        // functions.
        //-------------------------------------------------

        internal void CreatePropertyPages(IPropertySheetCallback lpProvider, IntPtr handle)
        {
            // Grab onto the handle that MMC gives us
            m_hPropertyPageRouter = handle;
            CPropPage[] ppages;

            ppages = m_aPropSheetPage;

            for (int i = 0; i < ppages.Length; i++)
            {
                // Initialize each property sheet
                ppages[i].Init(Cookie, handle);
                CreateSinglePropertyPage(lpProvider, ppages[i]);
            }
        }// CreatePropertyPages
コード例 #7
0
        }// GetListPadInfo

        //-------------------------------------------------------
        // Stuff for IExtendPropertySheet2 - This will only be called
        // on Property sheets in the result 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 we're asking for property pages based on a result item
            if (victim.Data != null && victim.Node.DoesResultHavePropertyPage(victim.Data))
            {
                CCommandHistory.CommandExecuted(victim, -1);
                victim.Node.CreateResultPropertyPages(lpProvider, handle, victim.Data);
            }
            // We don't have any property pages, let's return false
            else
            {
                MessageBox(0, "Got a false positive", "", 0);
                return(HRESULT.S_FALSE);
            }

            return(HRESULT.S_OK);
        }// CreatePropertyPages
コード例 #8
0
ファイル: cnode.cs プロジェクト: wolewd/Windows-Server-2003
        }// DoesResultHavePropertyPage

        internal void CreateResultPropertyPages(IPropertySheetCallback lpProvider, IntPtr handle, Object oResultData)
        {
            IColumnResultView crv = GetColumnResultView();

            if (crv != null)
            {
                // Grab onto the handle that MMC gives us
                m_hPropertyPageRouter = handle;
                // If we don't have a router handle yet, store one.
                if (CNodeManager.GoodRouterHandle == (IntPtr)(-1))
                {
                    CNodeManager.GoodRouterHandle = handle;
                }

                CPropPage[] ppages = crv.CreateNewPropPages(oResultData);

                int iLen = ppages.Length;
                for (int i = 0; i < iLen; i++)
                {
                    ppages[i].Init(Cookie, handle);
                    CreateSinglePropertyPage(lpProvider, ppages[i]);
                }
            }
        }// CreateResultPropertyPages
コード例 #9
0
ファイル: WSATPropertySheet.cs プロジェクト: mind0n/hive
        public int CreatePropertyPages(IPropertySheetCallback provider, IntPtr handle, System.Runtime.InteropServices.ComTypes.IDataObject dataObject)
        {
            const int E_UNEXPECTED = unchecked((int)0x8000ffff);
            if (dataObject != null)
            {
                if (Utilities.OSMajor <= 5)
                {
                    // REMARK: there is a BUG here:
                    // CCF_COM_WORKSTATION should return the machine name, 
                    // not CCF_COM_OBJECTKEY 
                    if (!TryGetResourceValue(dataObject, "CCF_COM_OBJECTKEY", out machineName))
                    {
                        return E_UNEXPECTED; 
                    }

                    if (!Utilities.IsLocalMachineName(machineName) && MsdtcClusterUtils.IsClusterServer(machineName))
                    {
                        //Remote cluster configuration is not supported
                        return HRESULT.S_FALSE;
                    }
                }
                else
                {
                    string dtcHostName;
                    if (!TryGetResourceValue(dataObject, "CCF_DTC_HOSTNAME", out dtcHostName))
                    {
                        return E_UNEXPECTED;
                    }

                    bool isDtcNode = false;
                    string dtcResource;
                    if (TryGetResourceValue(dataObject, "CCF_DTC_RESOURCE", out dtcResource) && !string.IsNullOrEmpty(dtcResource))
                    {
                        isDtcNode = true;
                    }

                    if (isDtcNode)
                    {
                        if (!MsdtcClusterUtils.ResolveVirtualServerName(dtcHostName, dtcResource, out virtualServer))
                        {
                            return E_UNEXPECTED;
                        }

                        if (!Utilities.SafeCompare(dtcHostName, virtualServer))
                        {
                            //Remote cluster configuration is not supported
                            return HRESULT.S_FALSE;
                        }
                    }
                    else
                    {
                        this.machineName = dtcHostName;
                    }
                }
            }

            int hr = 0;
            if (provider != null)
            {
                hr = provider.AddPage(handlePropSheetPage);
            }
            return hr;
        }
コード例 #10
0
        public int CreatePropertyPages(IPropertySheetCallback provider, IntPtr handle, System.Runtime.InteropServices.ComTypes.IDataObject dataObject)
        {
            const int E_UNEXPECTED = unchecked ((int)0x8000ffff);

            if (dataObject != null)
            {
                if (Utilities.OSMajor <= 5)
                {
                    // REMARK: there is a BUG here:
                    // CCF_COM_WORKSTATION should return the machine name,
                    // not CCF_COM_OBJECTKEY
                    if (!TryGetResourceValue(dataObject, "CCF_COM_OBJECTKEY", out machineName))
                    {
                        return(E_UNEXPECTED);
                    }

                    if (!Utilities.IsLocalMachineName(machineName) && MsdtcClusterUtils.IsClusterServer(machineName))
                    {
                        //Remote cluster configuration is not supported
                        return(HRESULT.S_FALSE);
                    }
                }
                else
                {
                    string dtcHostName;
                    if (!TryGetResourceValue(dataObject, "CCF_DTC_HOSTNAME", out dtcHostName))
                    {
                        return(E_UNEXPECTED);
                    }

                    bool   isDtcNode = false;
                    string dtcResource;
                    if (TryGetResourceValue(dataObject, "CCF_DTC_RESOURCE", out dtcResource) && !string.IsNullOrEmpty(dtcResource))
                    {
                        isDtcNode = true;
                    }

                    if (isDtcNode)
                    {
                        if (!MsdtcClusterUtils.ResolveVirtualServerName(dtcHostName, dtcResource, out virtualServer))
                        {
                            return(E_UNEXPECTED);
                        }

                        if (!Utilities.SafeCompare(dtcHostName, virtualServer))
                        {
                            //Remote cluster configuration is not supported
                            return(HRESULT.S_FALSE);
                        }
                    }
                    else
                    {
                        this.machineName = dtcHostName;
                    }
                }
            }

            int hr = 0;

            if (provider != null)
            {
                hr = provider.AddPage(handlePropSheetPage);
            }
            return(hr);
        }