Пример #1
0
        // 2 tip controls are created in desktop thread
        private bool ShowThumbnailTooltip(IntPtr pIDL, int iItem, bool fKey)
        {
            string path;
            StringBuilder sb = new StringBuilder(260);
            if(PInvoke.SHGetPathFromIDList(pIDL, sb)) {
                path = sb.ToString();

                if(File.Exists(path)) {
                    if(path.StartsWith(IDLWrapper.INDICATOR_NAMESPACE) || path.StartsWith(IDLWrapper.INDICATOR_NETWORK) ||
                            path.ToLower().StartsWith(@"a:\"))
                        return false;

                    string ext = Path.GetExtension(path).ToLower();
                    if(ext == ".lnk") {
                        path = ShellMethods.GetLinkTargetPath(path);
                        if(path.Length == 0)
                            return false;

                        ext = Path.GetExtension(path).ToLower();
                    }

                    if(ThumbnailTooltipForm.ExtIsSupported(ext)) {
                        if(thumbnailTooltip == null) {
                            thumbnailTooltip = new ThumbnailTooltipForm();
                            thumbnailTooltip.ThumbnailVisibleChanged +=
                                    new EventHandler(thumbnailTooltip_ThumbnailVisibleChanged);

                            timer_Thumbnail = new System.Windows.Forms.Timer(components);
                            timer_Thumbnail.Interval = 400;
                            timer_Thumbnail.Tick += new EventHandler(timer_Thumbnail_Tick);
                        }

                        if(thumbnailTooltip.IsShownByKey && !fKey) {
                            thumbnailTooltip.IsShownByKey = false;
                            return true;
                        }

                        thumbnailIndex = iItem;
                        thumbnailTooltip.IsShownByKey = fKey;

                        RECT rct = GetLVITEMRECT(hwndListView, iItem, false, 0);

                        return thumbnailTooltip.ShowToolTip(path, new Point(rct.right - 16, rct.bottom - 8));
                    }
                }
            }
            HideThumbnailTooltip();
            return false;
        }
Пример #2
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);
 }
Пример #3
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);
        }
Пример #4
0
 private bool ShowThumbnailTooltip(IntPtr pIDL, int iItem, IntPtr hwndListView, bool fKey) {
     StringBuilder pszPath = new StringBuilder(260);
     if(PInvoke.SHGetPathFromIDList(pIDL, pszPath)) {
         string path = pszPath.ToString();
         if(File.Exists(path)) {
             if((path.StartsWith("::") || path.StartsWith(@"\\")) || path.ToLower().StartsWith(@"a:\")) {
                 return false;
             }
             string ext = Path.GetExtension(path).ToLower();
             if(ext == ".lnk") {
                 path = ShellMethods.GetLinkTargetPath(path);
                 if(path.Length == 0) {
                     return false;
                 }
                 ext = Path.GetExtension(path).ToLower();
             }
             if(ThumbnailTooltipForm.ExtIsSupported(ext)) {
                 if(this.thumbnailTooltip == null) {
                     this.thumbnailTooltip = new ThumbnailTooltipForm();
                     this.thumbnailTooltip.ThumbnailVisibleChanged += new QEventHandler(this.thumbnailTooltip_ThumbnailVisibleChanged);
                     this.timer_Thumbnail = new System.Windows.Forms.Timer(this.components);
                     this.timer_Thumbnail.Interval = 400;
                     this.timer_Thumbnail.Tick += new EventHandler(this.timer_Thumbnail_Tick);
                 }
                 if(this.thumbnailTooltip.IsShownByKey && !fKey) {
                     this.thumbnailTooltip.IsShownByKey = false;
                     return true;
                 }
                 this.thumbnailIndex = iItem;
                 this.thumbnailTooltip.IsShownByKey = fKey;
                 // TODO
                 // QTTabBarLib.Interop.RECT rect = QTTabBarClass.GetLVITEMRECT(hwndListView, iItem, false, 0);
                 QTTabBarLib.Interop.RECT rect = new QTTabBarLib.Interop.RECT();
                 return this.thumbnailTooltip.ShowToolTip(path, new Point(rect.right - 0x10, rect.bottom - 8));
             }
         }
     }
     this.HideThumbnailTooltip();
     return false;
 }
 private bool ShowThumbnailTooltip(int iItem, Point pnt, bool fKey) {
     string linkTargetPath;
     if(ShellBrowser.TryGetHotTrackPath(iItem, out linkTargetPath)) {
         if((linkTargetPath.StartsWith("::") || linkTargetPath.StartsWith(@"\\")) || linkTargetPath.ToLower().StartsWith(@"a:\")) {
             return false;
         }
         string ext = Path.GetExtension(linkTargetPath).ToLower();
         if(ext == ".lnk") {
             linkTargetPath = ShellMethods.GetLinkTargetPath(linkTargetPath);
             if(linkTargetPath.Length == 0) {
                 return false;
             }
             ext = Path.GetExtension(linkTargetPath).ToLower();
         }
         if(ThumbnailTooltipForm.ExtIsSupported(ext)) {
             if(thumbnailTooltip == null) {
                 thumbnailTooltip = new ThumbnailTooltipForm();
                 thumbnailTooltip.ThumbnailVisibleChanged += thumbnailTooltip_ThumbnailVisibleChanged;
                 timer_Thumbnail = new Timer();
                 timer_Thumbnail.Interval = 400;
                 timer_Thumbnail.Tick += timer_Thumbnail_Tick;
             }
             if(thumbnailTooltip.IsShownByKey && !fKey) {
                 thumbnailTooltip.IsShownByKey = false;
                 return true;
             }
             thumbnailIndex = iItem;
             thumbnailTooltip.IsShownByKey = fKey;
             return thumbnailTooltip.ShowToolTip(linkTargetPath, pnt);
         }
         HideThumbnailTooltip(6);
     }
     return false;
 }
 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);
 }
Пример #7
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");
     }
 }
 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);
 }