Esempio n. 1
0
        private bool ShowSubDirTip(int iItem, bool fByKey, bool fSkipForegroundCheck)
        {
            string str;

            if ((fSkipForegroundCheck || (hwndExplorer == PInvoke.GetForegroundWindow())) && ShellBrowser.TryGetHotTrackPath(iItem, out str))
            {
                bool flag = false;
                try {
                    if (!ShellMethods.TryMakeSubDirTipPath(ref str))
                    {
                        return(false);
                    }
                    Point pnt = GetSubDirTipPoint(fByKey);
                    if (subDirTip == null)
                    {
                        subDirTip                                = new SubDirTipForm(hwndSubDirTipMessageReflect, true, this);
                        subDirTip.MenuClosed                    += subDirTip_MenuClosed;
                        subDirTip.MenuItemClicked               += subDirTip_MenuItemClicked;
                        subDirTip.MultipleMenuItemsClicked      += subDirTip_MultipleMenuItemsClicked;
                        subDirTip.MenuItemRightClicked          += subDirTip_MenuItemRightClicked;
                        subDirTip.MultipleMenuItemsRightClicked += subDirTip_MultipleMenuItemsRightClicked;
                        if (dropTargetPassthrough != null)
                        {
                            PInvoke.RegisterDragDrop(subDirTip.Handle, dropTargetPassthrough);
                        }
                    }
                    subDirTip.ShowSubDirTip(str, null, pnt);
                    flag = true;
                }
                catch {
                }
                return(flag);
            }
            return(false);
        }
Esempio n. 2
0
 public override void Dispose(bool fDisposing)
 {
     if (fDisposed)
     {
         return;
     }
     // Never call NativeWindow.ReleaseHandle().  EVER!!!
     if (ListViewController != null)
     {
         ListViewController.MessageCaptured -= ListViewController_MessageCaptured;
         ListViewController = null;
     }
     if (ShellViewController != null)
     {
         ShellViewController.MessageCaptured -= ShellViewController_MessageCaptured;
         ShellViewController = null;
     }
     if (timer_HoverSubDirTipMenu != null)
     {
         timer_HoverSubDirTipMenu.Dispose();
         timer_HoverSubDirTipMenu = null;
     }
     if (timer_Thumbnail != null)
     {
         timer_Thumbnail.Dispose();
         timer_Thumbnail = null;
     }
     if (thumbnailTooltip != null)
     {
         thumbnailTooltip.Dispose();
         thumbnailTooltip = null;
     }
     if (subDirTip != null)
     {
         subDirTip.Dispose();
         subDirTip = null;
     }
     if (dropTargetPassthrough != null)
     {
         dropTargetPassthrough.Dispose();
         dropTargetPassthrough = null;
     }
     base.Dispose(fDisposing);
 }
 public override void Dispose(bool fDisposing)
 {
     if (fDisposed)
     {
         return;
     }
     if (ListViewController != null)
     {
         ListViewController.ReleaseHandle();
         ListViewController = null;
     }
     if (ShellViewController != null)
     {
         ShellViewController.ReleaseHandle();
         ShellViewController = null;
     }
     if (timer_HoverSubDirTipMenu != null)
     {
         timer_HoverSubDirTipMenu.Dispose();
         timer_HoverSubDirTipMenu = null;
     }
     if (timer_Thumbnail != null)
     {
         timer_Thumbnail.Dispose();
         timer_Thumbnail = null;
     }
     if (thumbnailTooltip != null)
     {
         thumbnailTooltip.Dispose();
         thumbnailTooltip = null;
     }
     if (subDirTip != null)
     {
         subDirTip.Dispose();
         subDirTip = null;
     }
     if (dropTargetPassthrough != null)
     {
         dropTargetPassthrough.Dispose();
         dropTargetPassthrough = null;
     }
     base.Dispose(fDisposing);
 }
Esempio n. 4
0
        public override void ShowAndClickSubDirTip()
        {
            try {
                Address[] addressArray;
                string    str;
                if (ShellBrowser.TryGetSelection(out addressArray, out str, false) && ((addressArray.Length == 1) && !string.IsNullOrEmpty(addressArray[0].Path)))
                {
                    string path = addressArray[0].Path;
                    if (!path.StartsWith("::") && !Directory.Exists(path))
                    {
                        if (!Path.GetExtension(path).PathEquals(".lnk"))
                        {
                            return;
                        }
                        path = ShellMethods.GetLinkTargetPath(path);
                        if (string.IsNullOrEmpty(path) || !Directory.Exists(path))
                        {
                            return;
                        }
                    }
                    if (subDirTip == null)
                    {
                        subDirTip                                = new SubDirTipForm(hwndSubDirTipMessageReflect, true, this);
                        subDirTip.MenuClosed                    += subDirTip_MenuClosed;
                        subDirTip.MenuItemClicked               += subDirTip_MenuItemClicked;
                        subDirTip.MultipleMenuItemsClicked      += subDirTip_MultipleMenuItemsClicked;
                        subDirTip.MenuItemRightClicked          += subDirTip_MenuItemRightClicked;
                        subDirTip.MultipleMenuItemsRightClicked += subDirTip_MultipleMenuItemsRightClicked;
                    }

                    int iItem = ShellBrowser.GetFocusedIndex();
                    if (iItem != -1)
                    {
                        ShowSubDirTip(iItem, true, false);
                        subDirTip.PerformClickByKey();
                    }
                }
            }
            catch {
            }
        }
 public override void Dispose(bool fDisposing) {
     if(fDisposed) return;
     if(ListViewController != null) {
         ListViewController.ReleaseHandle();
         ListViewController = null;
     }
     if(ShellViewController != null) {
         ShellViewController.ReleaseHandle();
         ShellViewController = null;
     }
     if(timer_HoverSubDirTipMenu != null) {
         timer_HoverSubDirTipMenu.Dispose();
         timer_HoverSubDirTipMenu = null;
     }
     if(timer_Thumbnail != null) {
         timer_Thumbnail.Dispose();
         timer_Thumbnail = null;
     }
     if(thumbnailTooltip != null) {
         thumbnailTooltip.Dispose();
         thumbnailTooltip = null;
     }
     if(subDirTip != null) {
         subDirTip.Dispose();
         subDirTip = null;
     }
     if(dropTargetPassthrough != null) {
         dropTargetPassthrough.Dispose();
         dropTargetPassthrough = null;
     }
     base.Dispose(fDisposing);
 }
Esempio n. 6
0
 private void ShowSubdirTip_Tab(QTabItem tab, bool fShow, int offsetX, bool fKey, bool fParent) {
     try {
         if(fShow) {
             if(base.Explorer.Busy || string.IsNullOrEmpty(tab.CurrentPath)) {
                 this.tabControl1.SetSubDirTipShown(false);
             }
             else {
                 string currentPath = tab.CurrentPath;
                 if(fParent || TryMakeSubDirTipPath(ref currentPath)) {
                     if(this.subDirTip_Tab == null) {
                         this.subDirTip_Tab = new SubDirTipForm(base.Handle, this.ExplorerHandle, true);
                         this.subDirTip_Tab.MenuItemClicked += new ToolStripItemClickedEventHandler(this.subDirTip_MenuItemClicked);
                         this.subDirTip_Tab.MultipleMenuItemsClicked += new EventHandler(this.subDirTip_MultipleMenuItemsClicked);
                         this.subDirTip_Tab.MenuItemRightClicked += new ItemRightClickedEventHandler(this.subDirTip_MenuItemRightClicked);
                         this.subDirTip_Tab.MenuClosed += new EventHandler(this.subDriTip_Tab_MenuClosed);
                         this.subDirTip_Tab.MultipleMenuItemsRightClicked += new ItemRightClickedEventHandler(this.subDirTip_MultipleMenuItemsRightClicked);
                     }
                     this.ContextMenuedTab = tab;
                     Point pnt = this.tabControl1.PointToScreen(new Point(tab.TabBounds.X + offsetX, fParent ? tab.TabBounds.Top : (tab.TabBounds.Bottom - 3)));
                     if(tab != this.CurrentTab) {
                         pnt.X += 2;
                     }
                     this.tabControl1.SetSubDirTipShown(this.subDirTip_Tab.ShowMenuWithoutShowForm(currentPath, pnt, fParent));
                 }
                 else {
                     this.tabControl1.SetSubDirTipShown(false);
                     this.HideSubDirTip_Tab_Menu();
                 }
             }
         }
         else {
             this.HideSubDirTip_Tab_Menu();
         }
     }
     catch(Exception exception) {
         QTUtility2.MakeErrorLog(exception, "tabsubdir");
     }
 }
Esempio n. 7
0
        public override void CloseDW(uint dwReserved)
        {
            // called when the user disables the Desktop Tool
            // this seems not to be called on log off / shut down...

            if(iContextMenu2 != null) {
                Marshal.ReleaseComObject(iContextMenu2);
                iContextMenu2 = null;
            }

            // dispose controls in the thread they're created.
            if(thumbnailTooltip != null) {
                thumbnailTooltip.Invoke(d => d.Dispose());
                thumbnailTooltip = null;
            }
            if(subDirTip != null) {
                subDirTip.Invoke(d => d.Dispose());
                subDirTip = null;
            }

            // unhook, unsubclass
            if(hHook_MsgDesktop != IntPtr.Zero) {
                PInvoke.UnhookWindowsHookEx(hHook_MsgDesktop);
                hHook_MsgDesktop = IntPtr.Zero;
            }

            if(hHook_MsgShell_TrayWnd != IntPtr.Zero) {
                PInvoke.UnhookWindowsHookEx(hHook_MsgShell_TrayWnd);
                hHook_MsgShell_TrayWnd = IntPtr.Zero;
            }

            if(hHook_KeyDesktop != IntPtr.Zero) {
                PInvoke.UnhookWindowsHookEx(hHook_KeyDesktop);
                hHook_KeyDesktop = IntPtr.Zero;
            }

            if(shellViewListener != null) {
                shellViewListener.ReleaseHandle();
                shellViewListener = null;
            }

            base.CloseDW(dwReserved);
        }
Esempio n. 8
0
        private bool ShowSubDirTip(IntPtr pIDL, int iItem, bool fSkipFocusCheck)
        {
            // desktop thread ( desktop hook -> mouse hottrack, desktop hook -> keydown )

            if(fSkipFocusCheck || Config.Bool(Scts.SubDirTipForInactiveWindow) ||
                    hwndListView == PInvoke.GetFocus()) {
                try {
                    string path = ShellMethods.GetDisplayName(pIDL, false);
                    byte[] idl = ShellMethods.GetIDLData(pIDL);
                    bool fQTG;

                    if(QTTabBarClass.TryMakeSubDirTipPath(ref path, ref idl, false, out fQTG)) {
                        FOLDERVIEWMODE folderViewMode = FOLDERVIEWMODE.FVM_ICON;
                                // folderView.GetCurrentViewMode( ref folderViewMode );

                        RECT rct = GetLVITEMRECT(hwndListView, iItem, true, folderViewMode);
                        Point pnt = new Point(rct.right - 16, rct.bottom - 16);

                        if(subDirTip == null) {
                            //IntPtr hwndMessageParent = shellViewListener != null ? shellViewListener.Handle : IntPtr.Zero;

                            subDirTip = new SubDirTipForm(hwndShellView, hwndListView, false);
                            subDirTip.MenuItemClicked += subDirTip_MenuItemClicked;
                            subDirTip.MultipleMenuItemsClicked += subDirTip_MultipleMenuItemsClicked;
                            subDirTip.MenuItemRightClicked += subDirTip_MenuItemRightClicked;
                            subDirTip.MultipleMenuItemsRightClicked += subDirTip_MultipleMenuItemsRightClicked;
                        }

                        subDirTip.ShowSubDirTip(idl, pnt, hwndListView, fQTG);
                        return true;
                    }
                }
                catch(Exception ex) {
                    DebugUtil.AppendToExceptionLog(ex, null);
                }
            }
            return false;
        }
 private bool ShowSubDirTip(IntPtr pIDL, int iItem, IntPtr hwndListView, bool fSkipFocusCheck) {
     if(fSkipFocusCheck || (this.hwndListView == PInvoke.GetFocus())) {
         try {
             string displayName = ShellMethods.GetDisplayName(pIDL, false);
             if(!QTTabBarClass.TryMakeSubDirTipPath(ref displayName)) {
                 return false;
             }
             int pViewMode = 1;
             this.folderView.GetCurrentViewMode(ref pViewMode);
             // TODO
             // QTTabBarLib.Interop.RECT rect = QTTabBarClass.GetLVITEMRECT(hwndListView, iItem, true, pViewMode);
             QTTabBarLib.Interop.RECT rect = new QTTabBarLib.Interop.RECT();
             Point pnt = new Point(rect.right - 0x10, rect.bottom - 0x10);
             if(this.subDirTip == null) {
                 this.subDirTip = new SubDirTipForm(this.ThisHandle, this.hwndListView, false, null); // TODO
                 this.subDirTip.MenuItemClicked += new ToolStripItemClickedEventHandler(this.subDirTip_MenuItemClicked);
                 this.subDirTip.MultipleMenuItemsClicked += new EventHandler(this.subDirTip_MultipleMenuItemsClicked);
                 this.subDirTip.MenuItemRightClicked += new ItemRightClickedEventHandler(this.subDirTip_MenuItemRightClicked);
                 this.subDirTip.MultipleMenuItemsRightClicked += new ItemRightClickedEventHandler(this.subDirTip_MultipleMenuItemsRightClicked);
             }
             byte[] idl = null;
             if(QTUtility.IsVista && string.Equals(displayName, IDLWrapper.PATH_USERSFILES, StringComparison.OrdinalIgnoreCase)) {
                 idl = ShellMethods.GetIDLData(pIDL);
             }
             // TODO
             // this.subDirTip.ShowSubDirTip(displayName, idl, pnt, hwndListView);
             return true;
         }
         catch(Exception exception) {
             QTUtility2.MakeErrorLog(exception, null);
         }
     }
     return false;
 }
Esempio n. 10
0
 public override void CloseDW(uint dwReserved) {
     if(iContextMenu2 != null) {
         Marshal.ReleaseComObject(iContextMenu2);
         iContextMenu2 = null;
     }
     if(this.folderView != null) {
         Marshal.ReleaseComObject(this.folderView);
         this.folderView = null;
     }
     if(this.shellBrowser != null) {
         Marshal.ReleaseComObject(this.shellBrowser);
         this.shellBrowser = null;
     }
     DisposeInvoker method = new DisposeInvoker(this.InvokeDispose);
     if(this.thumbnailTooltip != null) {
         this.thumbnailTooltip.Invoke(method, new object[] { this.thumbnailTooltip });
         this.thumbnailTooltip = null;
     }
     if(this.subDirTip != null) {
         this.subDirTip.Invoke(method, new object[] { this.subDirTip });
         this.subDirTip = null;
     }
     if(this.hashForm != null) {
         this.hashForm.Invoke(method, new object[] { this.hashForm });
         this.hashForm = null;
     }
     if(this.hHook_MsgDesktop != IntPtr.Zero) {
         PInvoke.UnhookWindowsHookEx(this.hHook_MsgDesktop);
         this.hHook_MsgDesktop = IntPtr.Zero;
     }
     if(this.hHook_MsgShell_TrayWnd != IntPtr.Zero) {
         PInvoke.UnhookWindowsHookEx(this.hHook_MsgShell_TrayWnd);
         this.hHook_MsgShell_TrayWnd = IntPtr.Zero;
     }
     if(this.hHook_KeyDesktop != IntPtr.Zero) {
         PInvoke.UnhookWindowsHookEx(this.hHook_KeyDesktop);
         this.hHook_KeyDesktop = IntPtr.Zero;
     }
     if(this.shellViewController != null) {
         this.shellViewController.ReleaseHandle();
         this.shellViewController = null;
     }
     base.CloseDW(dwReserved);
 }
        public override void ShowAndClickSubDirTip() {
            try {
                Address[] addressArray;
                string str;
                if(ShellBrowser.TryGetSelection(out addressArray, out str, false) && ((addressArray.Length == 1) && !string.IsNullOrEmpty(addressArray[0].Path))) {
                    string path = addressArray[0].Path;
                    if(!path.StartsWith("::") && !Directory.Exists(path)) {
                        if(!Path.GetExtension(path).PathEquals(".lnk")) {
                            return;
                        }
                        path = ShellMethods.GetLinkTargetPath(path);
                        if(string.IsNullOrEmpty(path) || !Directory.Exists(path)) {
                            return;
                        }
                    }
                    if(subDirTip == null) {
                        subDirTip = new SubDirTipForm(hwndSubDirTipMessageReflect, true, this);
                        subDirTip.MenuClosed += subDirTip_MenuClosed;
                        subDirTip.MenuItemClicked += subDirTip_MenuItemClicked;
                        subDirTip.MultipleMenuItemsClicked += subDirTip_MultipleMenuItemsClicked;
                        subDirTip.MenuItemRightClicked += subDirTip_MenuItemRightClicked;
                        subDirTip.MultipleMenuItemsRightClicked += subDirTip_MultipleMenuItemsRightClicked;
                    }

                    int iItem = ShellBrowser.GetFocusedIndex();
                    if(iItem != -1) {
                        ShowSubDirTip(iItem, true, false);
                        subDirTip.PerformClickByKey();
                    }
                }
            }
            catch {
            }
        }
 private bool ShowSubDirTip(int iItem, bool fByKey, bool fSkipForegroundCheck) {
     string str;
     if((fSkipForegroundCheck || (hwndExplorer == PInvoke.GetForegroundWindow())) && ShellBrowser.TryGetHotTrackPath(iItem, out str)) {
         bool flag = false;
         try {
             if(!ShellMethods.TryMakeSubDirTipPath(ref str)) {
                 return false;
             }
             Point pnt = GetSubDirTipPoint(fByKey);
             if(subDirTip == null) {
                 subDirTip = new SubDirTipForm(hwndSubDirTipMessageReflect, true, this);
                 subDirTip.MenuClosed += subDirTip_MenuClosed;
                 subDirTip.MenuItemClicked += subDirTip_MenuItemClicked;
                 subDirTip.MultipleMenuItemsClicked += subDirTip_MultipleMenuItemsClicked;
                 subDirTip.MenuItemRightClicked += subDirTip_MenuItemRightClicked;
                 subDirTip.MultipleMenuItemsRightClicked += subDirTip_MultipleMenuItemsRightClicked;
                 if(dropTargetPassthrough != null) {
                     PInvoke.RegisterDragDrop(subDirTip.Handle, dropTargetPassthrough);
                 }
             }
             subDirTip.ShowSubDirTip(str, null, pnt);
             flag = true;
         }
         catch {
         }
         return flag;
     }
     return false;
 }
Esempio n. 13
0
 public override void CloseDW(uint dwReserved) {
     try {
         if(treeViewWrapper != null) {
             treeViewWrapper.Dispose();
             treeViewWrapper = null;
         }
         if(listViewManager != null) {
             listViewManager.Dispose();
             listViewManager = null;
         }
         if(subDirTip_Tab != null) {
             subDirTip_Tab.Dispose();
             subDirTip_Tab = null;
         }
         if(IsShown) {
             if(pluginManager != null) {
                 pluginManager.Close(false);
                 pluginManager = null;
             }
             if(hHook_Key != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(hHook_Key);
                 hHook_Key = IntPtr.Zero;
             }
             if(hHook_Mouse != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(hHook_Mouse);
                 hHook_Mouse = IntPtr.Zero;
             }
             if(hHook_Msg != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(hHook_Msg);
                 hHook_Msg = IntPtr.Zero;
             }
             if(explorerController != null) {
                 explorerController.ReleaseHandle();
                 explorerController = null;
             }
             if(rebarController != null) {
                 rebarController.ReleaseHandle();
                 rebarController = null;
             }
             if(!QTUtility.IsXP && (travelBtnController != null)) {
                 travelBtnController.ReleaseHandle();
                 travelBtnController = null;
             }
             if(dicNotifyIcon != null) {
                 dicNotifyIcon.Remove(ExplorerHandle);
             }
             if((hwndNotifyIconParent == ExplorerHandle) && (notifyIcon != null)) {
                 notifyIcon.Dispose();
                 notifyIcon = null;
                 contextMenuNotifyIcon.Dispose();
                 contextMenuNotifyIcon = null;
                 hwndNotifyIconParent = IntPtr.Zero;
                 if(dicNotifyIcon.Count > 0) {
                     foreach(IntPtr ptr in dicNotifyIcon.Keys) {
                         IntPtr tabBarHandle = QTUtility.instanceManager.GetTabBarHandle(ptr);
                         if(1 == ((int)QTUtility2.SendCOPYDATASTRUCT(tabBarHandle, (IntPtr)0x30, "createNI", IntPtr.Zero))) {
                             break;
                         }
                     }
                 }
             }
             using(RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) {
                 if(!QTUtility.CheckConfig(Settings.NoHistory)) {
                     foreach(QTabItem item in tabControl1.TabPages) {
                         AddToHistory(item);
                     }
                     QTUtility.SaveRecentlyClosed(key);
                 }
                 if(!QTUtility.CheckConfig(Settings.NoRecentFiles) && QTUtility.CheckConfig(Settings.AllRecentFiles)) {
                     QTUtility.SaveRecentFiles(key);
                 }
                 string[] list = (from QTabItem item2 in tabControl1.TabPages
                         where item2.TabLocked
                         select item2.CurrentPath).ToArray();
                 QTUtility2.WriteRegBinary(list, "TabsLocked", key);
                 key.SetValue("StartUpGroups", QTUtility.StartUpGroupList.StringJoin(";"));
                 if(QTUtility.instanceManager.RemoveInstance(ExplorerHandle, this)) {
                     QTUtility.instanceManager.NextInstanceExists();
                     QTUtility2.WriteRegHandle("Handle", key, QTUtility.instanceManager.CurrentHandle);
                 }
                 if(QTUtility.CheckConfig(Settings.SaveTransparency)) {
                     if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000))) {
                         QTUtility.WindowAlpha = 0xff;
                     }
                     else {
                         byte num;
                         int num2;
                         int num3;
                         if(PInvoke.GetLayeredWindowAttributes(ExplorerHandle, out num2, out num, out num3)) {
                             QTUtility.WindowAlpha = num;
                         }
                         else {
                             QTUtility.WindowAlpha = 0xff;
                         }
                     }
                     key.SetValue("WindowAlpha", QTUtility.WindowAlpha);
                 }
                 IDLWrapper.SaveCache(key);
             }
             if((md5Form != null) && !md5Form.InvokeRequired) {
                 md5Form.SaveMD5FormStat();
                 md5Form.Dispose();
                 md5Form = null;
             }
             Cursor = Cursors.Default;
             if((curTabDrag != null) && (curTabDrag != Cursors.Default)) {
                 PInvoke.DestroyIcon(curTabDrag.Handle);
                 GC.SuppressFinalize(curTabDrag);
                 curTabDrag = null;
             }
             if((curTabCloning != null) && (curTabCloning != Cursors.Default)) {
                 PInvoke.DestroyIcon(curTabCloning.Handle);
                 GC.SuppressFinalize(curTabCloning);
                 curTabCloning = null;
             }
             if(dropTargetWrapper != null) {
                 dropTargetWrapper.Dispose();
                 dropTargetWrapper = null;
             }
             if((optionsDialog != null) && fOptionDialogCreated) {
                 fOptionDialogCreated = false;
                 try {
                     optionsDialog.Invoke(new MethodInvoker(odCallback_Close));
                 }
                 catch(Exception exception) {
                     QTUtility2.MakeErrorLog(exception, "optionDialogDisposing");
                 }
             }
             if(tabSwitcher != null) {
                 tabSwitcher.Dispose();
                 tabSwitcher = null;
             }
         }
         QTUtility.InstancesCount--;
         if(TravelLog != null) {
             Marshal.FinalReleaseComObject(TravelLog);
             TravelLog = null;
         }
         if(iContextMenu2 != null) {
             Marshal.FinalReleaseComObject(iContextMenu2);
             iContextMenu2 = null;
         }
         if(ShellBrowser != null) {
             ShellBrowser.Dispose();
             ShellBrowser = null;
         }
         foreach(ITravelLogEntry entry in LogEntryDic.Values) {
             if(entry != null) {
                 Marshal.FinalReleaseComObject(entry);
             }
         }
         LogEntryDic.Clear();
         if(bmpRebar != null) {
             bmpRebar.Dispose();
             bmpRebar = null;
         }
         if(textureBrushRebar != null) {
             textureBrushRebar.Dispose();
             textureBrushRebar = null;
         }
         fFinalRelease = true;
         base.CloseDW(dwReserved);
     }
     catch(Exception exception2) {
         QTUtility2.MakeErrorLog(exception2, "tabbar closing");
     }
 }
Esempio n. 14
0
        public override void CloseDW(uint dwReserved)
        {
            try {
                if(treeViewWrapper != null) {
                    treeViewWrapper.Dispose();
                    treeViewWrapper = null;
                }
                if(listViewManager != null) {
                    listViewManager.Dispose();
                    listViewManager = null;
                }
                if(subDirTip_Tab != null) {
                    subDirTip_Tab.Dispose();
                    subDirTip_Tab = null;
                }
                if(IsShown) {
                    if(pluginServer != null) {
                        pluginServer.Dispose();
                        pluginServer = null;
                    }
                    if(hHook_Key != IntPtr.Zero) {
                        PInvoke.UnhookWindowsHookEx(hHook_Key);
                        hHook_Key = IntPtr.Zero;
                    }
                    if(hHook_Mouse != IntPtr.Zero) {
                        PInvoke.UnhookWindowsHookEx(hHook_Mouse);
                        hHook_Mouse = IntPtr.Zero;
                    }
                    if(hHook_Msg != IntPtr.Zero) {
                        PInvoke.UnhookWindowsHookEx(hHook_Msg);
                        hHook_Msg = IntPtr.Zero;
                    }
                    if(explorerController != null) {
                        explorerController.ReleaseHandle();
                        explorerController = null;
                    }
                    if(rebarController != null) {
                        rebarController.Dispose();
                        rebarController = null;
                    }
                    if(!QTUtility.IsXP && (travelBtnController != null)) {
                        travelBtnController.ReleaseHandle();
                        travelBtnController = null;
                    }
                    InstanceManager.RemoveFromTrayIcon(Handle);

                    // TODO: check this
                    using(RegistryKey key = Registry.CurrentUser.CreateSubKey(RegConst.Root)) {
                        if(Config.Misc.KeepHistory) {
                            foreach(QTabItem item in tabControl1.TabPages) {
                                AddToHistory(item);
                            }
                            QTUtility.SaveRecentlyClosed(key);
                        }
                        if(Config.Misc.KeepRecentFiles) {
                            QTUtility.SaveRecentFiles(key);
                        }
                        string[] list = (from QTabItem item2 in tabControl1.TabPages
                                where item2.TabLocked
                                select item2.CurrentPath).ToArray();
                        QTUtility2.WriteRegBinary(list, "TabsLocked", key);
                        InstanceManager.UnregisterTabBar();
                        if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000))) {
                            QTUtility.WindowAlpha = 0xff;
                        }
                        else {
                            byte num;
                            int num2;
                            int num3;
                            if(PInvoke.GetLayeredWindowAttributes(ExplorerHandle, out num2, out num, out num3)) {
                                QTUtility.WindowAlpha = num;
                            }
                            else {
                                QTUtility.WindowAlpha = 0xff;
                            }
                        }
                        key.SetValue("WindowAlpha", QTUtility.WindowAlpha);
                        IDLWrapper.SaveCache(key);
                    }
                    if((md5Form != null) && !md5Form.InvokeRequired) {
                        md5Form.SaveMD5FormStat();
                        md5Form.Dispose();
                        md5Form = null;
                    }
                    Cursor = Cursors.Default;
                    if((curTabDrag != null) && (curTabDrag != Cursors.Default)) {
                        PInvoke.DestroyIcon(curTabDrag.Handle);
                        GC.SuppressFinalize(curTabDrag);
                        curTabDrag = null;
                    }
                    if((curTabCloning != null) && (curTabCloning != Cursors.Default)) {
                        PInvoke.DestroyIcon(curTabCloning.Handle);
                        GC.SuppressFinalize(curTabCloning);
                        curTabCloning = null;
                    }
                    if(dropTargetWrapper != null) {
                        dropTargetWrapper.Dispose();
                        dropTargetWrapper = null;
                    }
                    OptionsDialog.ForceClose();
                    if(tabSwitcher != null) {
                        tabSwitcher.Dispose();
                        tabSwitcher = null;
                    }
                }
                if(TravelLog != null) {
                    Marshal.FinalReleaseComObject(TravelLog);
                    TravelLog = null;
                }
                if(shellContextMenu != null) {
                    shellContextMenu.Dispose();
                    shellContextMenu = null;
                }
                if(ShellBrowser != null) {
                    ShellBrowser.Dispose();
                    ShellBrowser = null;
                }
                foreach(ITravelLogEntry entry in LogEntryDic.Values) {
                    if(entry != null) {
                        Marshal.FinalReleaseComObject(entry);
                    }
                }
                LogEntryDic.Clear();
                fFinalRelease = true;
                base.CloseDW(dwReserved);
            }
            catch(Exception exception2) {
                QTUtility2.MakeErrorLog(exception2, "tabbar closing");
            }
        }
Esempio n. 15
0
 private void ShowSubdirTip_Tab(QTabItem tab, bool fShow, int offsetX, bool fKey, bool fParent) {
     try {
         if(fShow) {
             if(Explorer.Busy || string.IsNullOrEmpty(tab.CurrentPath)) {
                 tabControl1.SetSubDirTipShown(false);
             }
             else {
                 string currentPath = tab.CurrentPath;
                 if(fParent || ShellMethods.TryMakeSubDirTipPath(ref currentPath)) {
                     if(subDirTip_Tab == null) {
                         subDirTip_Tab = new SubDirTipForm(Handle, true, listView);
                         subDirTip_Tab.MenuItemClicked += subDirTip_MenuItemClicked;
                         subDirTip_Tab.MultipleMenuItemsClicked += subDirTip_MultipleMenuItemsClicked;
                         subDirTip_Tab.MenuItemRightClicked += subDirTip_MenuItemRightClicked;
                         subDirTip_Tab.MenuClosed += subDirTip_Tab_MenuClosed;
                         subDirTip_Tab.MultipleMenuItemsRightClicked += subDirTip_MultipleMenuItemsRightClicked;
                     }
                     ContextMenuedTab = tab;
                     Point pnt = tabControl1.PointToScreen(new Point(tab.TabBounds.X + offsetX, fParent ? tab.TabBounds.Top : (tab.TabBounds.Bottom - 3)));
                     if(tab != CurrentTab) {
                         pnt.X += 2;
                     }
                     tabControl1.SetSubDirTipShown(subDirTip_Tab.ShowMenuWithoutShowForm(currentPath, pnt, fParent));
                 }
                 else {
                     tabControl1.SetSubDirTipShown(false);
                     HideSubDirTip_Tab_Menu();
                 }
             }
         }
         else {
             HideSubDirTip_Tab_Menu();
         }
     }
     catch(Exception exception) {
         QTUtility2.MakeErrorLog(exception, "tabsubdir");
     }
 }
Esempio n. 16
0
 public override void CloseDW(uint dwReserved) {
     try {
         if(this.thumbnailTooltip != null) {
             this.thumbnailTooltip.Dispose();
             this.thumbnailTooltip = null;
         }
         if(this.subDirTip != null) {
             this.subDirTip.Dispose();
             this.subDirTip = null;
         }
         if(this.subDirTip_Tab != null) {
             this.subDirTip_Tab.Dispose();
             this.subDirTip_Tab = null;
         }
         if(this.IsShown) {
             if(this.pluginManager != null) {
                 this.pluginManager.Close(false);
                 this.pluginManager = null;
             }
             if(this.hHook_Key != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(this.hHook_Key);
                 this.hHook_Key = IntPtr.Zero;
             }
             if(this.hHook_Mouse != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(this.hHook_Mouse);
                 this.hHook_Mouse = IntPtr.Zero;
             }
             if(this.hHook_Msg != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(this.hHook_Msg);
                 this.hHook_Msg = IntPtr.Zero;
             }
             if(this.explorerController != null) {
                 this.explorerController.ReleaseHandle();
                 this.explorerController = null;
             }
             if(this.shellViewController != null) {
                 this.shellViewController.ReleaseHandle();
                 this.shellViewController = null;
             }
             if(this.rebarController != null) {
                 this.rebarController.ReleaseHandle();
                 this.rebarController = null;
             }
             if(QTUtility.IsVista && (this.travelBtnController != null)) {
                 this.travelBtnController.ReleaseHandle();
                 this.travelBtnController = null;
             }
             if(dicNotifyIcon != null) {
                 dicNotifyIcon.Remove(this.ExplorerHandle);
             }
             if((hwndNotifyIconParent == this.ExplorerHandle) && (notifyIcon != null)) {
                 notifyIcon.Dispose();
                 notifyIcon = null;
                 contextMenuNotifyIcon.Dispose();
                 contextMenuNotifyIcon = null;
                 hwndNotifyIconParent = IntPtr.Zero;
                 if(dicNotifyIcon.Count > 0) {
                     foreach(IntPtr ptr in dicNotifyIcon.Keys) {
                         IntPtr tabBarHandle = QTUtility.instanceManager.GetTabBarHandle(ptr);
                         if(1 == ((int)QTUtility2.SendCOPYDATASTRUCT(tabBarHandle, (IntPtr)0x30, "createNI", IntPtr.Zero))) {
                             break;
                         }
                     }
                 }
             }
             using(RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) {
                 if(!QTUtility.CheckConfig(Settings.NoHistory)) {
                     foreach(QTabItem item in this.tabControl1.TabPages) {
                         AddToHistory(item);
                     }
                     QTUtility.SaveRecentlyClosed(key);
                 }
                 if(!QTUtility.CheckConfig(Settings.NoRecentFiles) && QTUtility.CheckConfig(Settings.AllRecentFiles)) {
                     QTUtility.SaveRecentFiles(key);
                 }
                 List<string> list = new List<string>();
                 foreach(QTabItem item2 in this.tabControl1.TabPages) {
                     if(item2.TabLocked) {
                         list.Add(item2.CurrentPath);
                     }
                 }
                 QTUtility2.WriteRegBinary<string>(list.ToArray(), "TabsLocked", key);
                 string str = string.Empty;
                 foreach(string str2 in QTUtility.StartUpGroupList) {
                     str = str + str2 + ";";
                 }
                 str = str.TrimEnd(QTUtility.SEPARATOR_CHAR);
                 key.SetValue("StartUpGroups", str);
                 if(QTUtility.instanceManager.RemoveInstance(this.ExplorerHandle, this)) {
                     QTUtility.instanceManager.NextInstanceExists();
                     QTUtility2.WriteRegHandle("Handle", key, QTUtility.instanceManager.CurrentHandle);
                 }
                 if(QTUtility.CheckConfig(Settings.SaveTransparency)) {
                     if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(this.ExplorerHandle, -20), 0x80000))) {
                         QTUtility.WindowAlpha = 0xff;
                     }
                     else {
                         byte num;
                         int num2;
                         int num3;
                         if(PInvoke.GetLayeredWindowAttributes(this.ExplorerHandle, out num2, out num, out num3)) {
                             QTUtility.WindowAlpha = num;
                         }
                         else {
                             QTUtility.WindowAlpha = 0xff;
                         }
                     }
                     key.SetValue("WindowAlpha", QTUtility.WindowAlpha);
                 }
                 IDLWrapper.SaveCache(key);
             }
             if((md5Form != null) && !md5Form.InvokeRequired) {
                 md5Form.SaveMD5FormStat();
                 md5Form.Dispose();
                 md5Form = null;
             }
             this.Cursor = Cursors.Default;
             if((this.curTabDrag != null) && (this.curTabDrag != Cursors.Default)) {
                 PInvoke.DestroyIcon(this.curTabDrag.Handle);
                 GC.SuppressFinalize(this.curTabDrag);
                 this.curTabDrag = null;
             }
             if((this.curTabCloning != null) && (this.curTabCloning != Cursors.Default)) {
                 PInvoke.DestroyIcon(this.curTabCloning.Handle);
                 GC.SuppressFinalize(this.curTabCloning);
                 this.curTabCloning = null;
             }
             if(this.dropTargetWrapper != null) {
                 this.dropTargetWrapper.Dispose();
                 this.dropTargetWrapper = null;
             }
             if((optionsDialog != null) && this.fOptionDialogCreated) {
                 this.fOptionDialogCreated = false;
                 try {
                     optionsDialog.Invoke(new MethodInvoker(this.odCallback_Close));
                 }
                 catch(Exception exception) {
                     QTUtility2.MakeErrorLog(exception, "optionDialogDisposing");
                 }
             }
             if(this.tabSwitcher != null) {
                 this.tabSwitcher.Dispose();
                 this.tabSwitcher = null;
             }
         }
         QTUtility.InstancesCount--;
         if(this.TravelLog != null) {
             Marshal.FinalReleaseComObject(this.TravelLog);
             this.TravelLog = null;
         }
         if(this.iContextMenu2 != null) {
             Marshal.FinalReleaseComObject(this.iContextMenu2);
             this.iContextMenu2 = null;
         }
         if(this.ShellBrowser != null) {
             Marshal.FinalReleaseComObject(this.ShellBrowser);
             this.ShellBrowser = null;
         }
         foreach(ITravelLogEntry entry in this.LogEntryDic.Values) {
             if(entry != null) {
                 Marshal.FinalReleaseComObject(entry);
             }
         }
         this.LogEntryDic.Clear();
         if(this.bmpRebar != null) {
             this.bmpRebar.Dispose();
             this.bmpRebar = null;
         }
         if(this.textureBrushRebar != null) {
             this.textureBrushRebar.Dispose();
             this.textureBrushRebar = null;
         }
         base.fFinalRelease = true;
         base.CloseDW(dwReserved);
     }
     catch(Exception exception2) {
         QTUtility2.MakeErrorLog(exception2, "tabbar closing");
     }
 }
Esempio n. 17
0
        private bool ShowSubDirTip(int iItem, bool fByKey, bool fSkipForegroundCheck) {
            string str;
            if((fSkipForegroundCheck || (this.ExplorerHandle == PInvoke.GetForegroundWindow())) && this.TryGetHotTrackPath(iItem, out str)) {
                bool flag = false;
                try {
                    if(!TryMakeSubDirTipPath(ref str)) {
                        return false;
                    }
                    Point pnt = listViewWrapper.GetSubDirTipPoint(fByKey);

                    if(this.subDirTip == null) {
                        this.subDirTip = new SubDirTipForm(base.Handle, this.ExplorerHandle, true, listViewWrapper);
                        this.subDirTip.MenuItemClicked += new ToolStripItemClickedEventHandler(this.subDirTip_MenuItemClicked);
                        this.subDirTip.MultipleMenuItemsClicked += new EventHandler(this.subDirTip_MultipleMenuItemsClicked);
                        this.subDirTip.MenuItemRightClicked += new ItemRightClickedEventHandler(this.subDirTip_MenuItemRightClicked);
                        this.subDirTip.MultipleMenuItemsRightClicked += new ItemRightClickedEventHandler(this.subDirTip_MultipleMenuItemsRightClicked);
                    }
                    this.subDirTip.ShowSubDirTip(str, null, pnt);
                    flag = true;
                }
                catch {
                }
                return flag;
            }
            return false;
        }
Esempio n. 18
0
        private void ShowAndClickSubDirTip() {
            try {
                Address[] addressArray;
                string str;
                if(this.TryGetSelection(out addressArray, out str, false) && ((addressArray.Length == 1) && !string.IsNullOrEmpty(addressArray[0].Path))) {
                    string path = addressArray[0].Path;
                    if(!path.StartsWith("::") && !Directory.Exists(path)) {
                        if(!string.Equals(Path.GetExtension(path), ".lnk", StringComparison.OrdinalIgnoreCase)) {
                            return;
                        }
                        path = ShellMethods.GetLinkTargetPath(path);
                        if(string.IsNullOrEmpty(path) || !Directory.Exists(path)) {
                            return;
                        }
                    }
                    if(this.subDirTip == null) {
                        this.subDirTip = new SubDirTipForm(base.Handle, this.ExplorerHandle, true, listViewWrapper);
                        this.subDirTip.MenuItemClicked += new ToolStripItemClickedEventHandler(this.subDirTip_MenuItemClicked);
                        this.subDirTip.MultipleMenuItemsClicked += new EventHandler(this.subDirTip_MultipleMenuItemsClicked);
                        this.subDirTip.MenuItemRightClicked += new ItemRightClickedEventHandler(this.subDirTip_MenuItemRightClicked);
                        this.subDirTip.MultipleMenuItemsRightClicked += new ItemRightClickedEventHandler(this.subDirTip_MultipleMenuItemsRightClicked);
                    }

                    int iItem = listViewWrapper.GetFocusedItem();
                    if(iItem != -1) {
                        this.ShowSubDirTip(iItem, true, false);
                        this.subDirTip.PerformClickByKey();
                    }
                }
            }
            catch {
            }
        }
 public override void Dispose(bool fDisposing) {
     if(fDisposed) return;
     // Never call NativeWindow.ReleaseHandle().  EVER!!!
     if(ListViewController != null) {
         ListViewController.MessageCaptured -= ListViewController_MessageCaptured;
         ListViewController = null;
     }
     if(ShellViewController != null) {
         ShellViewController.MessageCaptured -= ShellViewController_MessageCaptured;
         ShellViewController = null;
     }
     if(timer_HoverSubDirTipMenu != null) {
         timer_HoverSubDirTipMenu.Dispose();
         timer_HoverSubDirTipMenu = null;
     }
     if(timer_Thumbnail != null) {
         timer_Thumbnail.Dispose();
         timer_Thumbnail = null;
     }
     if(thumbnailTooltip != null) {
         thumbnailTooltip.Dispose();
         thumbnailTooltip = null;
     }
     if(subDirTip != null) {
         subDirTip.Dispose();
         subDirTip = null;
     }
     if(dropTargetPassthrough != null) {
         dropTargetPassthrough.Dispose();
         dropTargetPassthrough = null;
     }
     base.Dispose(fDisposing);
 }