Ejemplo n.º 1
0
        public void Dispose()
        {
            RestoreGlyphs();

            if (customGlyphs != null)
            {
                customGlyphs.Dispose();
                customGlyphs = null;
            }
            if (customGlyphsShortList != null)
            {
                customGlyphsShortList.Dispose();
                customGlyphsShortList = null;
            }
            if (customGlyphsLongList != null)
            {
                customGlyphsLongList.Dispose();
                customGlyphsLongList = null;
            }
            if (SEViewControl != null)
            {
                SEViewControl.OverrideImages = false;
                SEViewControl = null;
            }
            SolutionExplorer = null;
            Tree             = null;
        }
Ejemplo n.º 2
0
        private IntPtr FindInVBFloatingPalettes(string wndCaption)
        {
            IntPtr hFloatingPalette = NativeTreeView.FindWindowEx(IntPtr.Zero, IntPtr.Zero, VBFLOATINGPALETTE, null);

            while (hFloatingPalette != IntPtr.Zero)
            {
                IntPtr hSEWnd = FindSolutionExplorerWnd(hFloatingPalette, wndCaption);
                if (hSEWnd != IntPtr.Zero)
                {
                    return(hSEWnd);
                }
                hFloatingPalette = NativeTreeView.FindWindowEx(IntPtr.Zero, hFloatingPalette, VBFLOATINGPALETTE, null);
            }
            return(IntPtr.Zero);
        }
Ejemplo n.º 3
0
        private IntPtr FindSolutionExplorerWnd(IntPtr hparent, string wndCaption)
        {
            // is it directly under the parent?
            IntPtr hSEWnd = NativeTreeView.FindWindowEx(hparent, IntPtr.Zero, GENERICPANE, wndCaption);

            if (hSEWnd != IntPtr.Zero)
            {
                return(hSEWnd);
            }

            IntPtr win = NativeTreeView.FindWindowEx(hparent, IntPtr.Zero, null, null);

            while (win != IntPtr.Zero)
            {
                hSEWnd = FindSolutionExplorerWnd(win, wndCaption);
                if (hSEWnd != IntPtr.Zero)
                {
                    return(hSEWnd);
                }
                win = NativeTreeView.FindWindowEx(hparent, win, null, null);
            }

            return(IntPtr.Zero);
        }
Ejemplo n.º 4
0
        public void Capture()
        {
            if (SEViewControl != null && SEViewControl.IsValid)
            {
                return;
            }

            EnvDTE.Window window;
            try
            {
                SolutionExplorer = FindSolutionExplorerFrame();

                window = VsShellUtilities.GetWindowObject(SolutionExplorer);
            }
            catch (COMException)
            {
                // for VS2010 - WPF Shell compatibility (we cannot find the solution explorer frame there)
                return;
            }

            string expCaption = window.Caption;

            IntPtr handle = IntPtr.Zero;

            if (window.HWnd != IntPtr.Zero)
            {
                // We've got the parent
                handle = (IntPtr)window.HWnd;
            }
            else
            {
                EnvDTE.Window hostWindow = window.LinkedWindowFrame;

                if (hostWindow != null)
                {
                    handle = FindSolutionExplorerWnd((IntPtr)hostWindow.HWnd, expCaption);
                }

                if (handle == IntPtr.Zero)
                {
                    hostWindow = window.DTE.MainWindow;

                    if (hostWindow != null)
                    {
                        handle = FindSolutionExplorerWnd((IntPtr)hostWindow.HWnd, expCaption);
                    }
                }

                if (handle == IntPtr.Zero)
                {
                    handle = FindInVBFloatingPalettes(expCaption);
                }
            }

            if (handle == IntPtr.Zero)
            {
                return; // Not found :(
            }
            IntPtr uiHierarchy = NativeTreeView.FindWindowEx(handle, IntPtr.Zero,
                                                             UIHIERARCHY, null);
            IntPtr treeHwnd = NativeTreeView.FindWindowEx(uiHierarchy, IntPtr.Zero, TREEVIEW,
                                                          null);

            if (treeHwnd == IntPtr.Zero)
            {
                return;
            }

            SEViewControl = new NativeTreeView(treeHwnd);

            SetGlyphs();
        }