Ejemplo n.º 1
0
 public override void CloseDW(uint dwReserved) {
     try {
         if(pluginManager != null) {
             pluginManager.Close(true);
             pluginManager = null;
         }
         if(iContextMenu2 != null) {
             Marshal.FinalReleaseComObject(iContextMenu2);
             iContextMenu2 = null;
         }
         foreach(IntPtr ptr in lstPUITEMIDCHILD) {
             if(ptr != IntPtr.Zero) {
                 PInvoke.CoTaskMemFree(ptr);
             }
         }
         if(dropTargetWrapper != null) {
             dropTargetWrapper.Dispose();
             dropTargetWrapper = null;
         }
         QTUtility.instanceManager.RemoveButtonBarHandle(ExplorerHandle);
         fFinalRelease = false;
         base.CloseDW(dwReserved);
     }
     catch(Exception exception) {
         QTUtility2.MakeErrorLog(exception, "buttonbar closing");
     }
 }
Ejemplo n.º 2
0
        protected override void OnExplorerAttached() {
            ExplorerHandle = (IntPtr)Explorer.HWND;
            QTUtility.instanceManager.AddButtonBarHandle(ExplorerHandle, Handle);
            dropTargetWrapper = new DropTargetWrapper(this);
            QTTabBarClass tabBar = QTUtility.instanceManager.GetTabBar(ExplorerHandle);

            // If the TabBar and its PluginManager already exist, that means
            // the ButtonBar must have been closed when the Explorer window
            // opened, so we wont' get an initialization message.  Do 
            // initialization now.
            if(fNoSettings || (tabBar != null && tabBar.PluginServerInstance != null)) {
                if(pluginManager == null) {
                    if(tabBar != null) {
                        pluginManager = tabBar.PluginServerInstance;
                        if(pluginManager != null) {
                            pluginManager.AddRef();
                        }
                    }
                    CreateItems(false);
                }
                fNoSettings = false;
            }
        }
 protected override void Dispose(bool disposing) {
     if(dropTargetWrapper != null) {
         dropTargetWrapper.Dispose();
         dropTargetWrapper = null;
     }
     if(bmpInsertL != null) {
         bmpInsertL.Dispose();
         bmpInsertL = null;
     }
     if(bmpInsertR != null) {
         bmpInsertR.Dispose();
         bmpInsertR = null;
     }
     if(timerScroll != null) {
         timerScroll.Dispose();
         timerScroll = null;
     }
     base.Dispose(disposing);
 }
 private void DropDownMenuDropTarget_HandleCreated(object sender, EventArgs e) {
     dropTargetWrapper = new DropTargetWrapper(this);
     dropTargetWrapper.DragFileEnter += dropTargetWrapper_DragFileEnter;
     dropTargetWrapper.DragFileOver += dropTargetWrapper_DragFileOver;
     dropTargetWrapper.DragFileLeave += dropTargetWrapper_DragFileLeave;
     dropTargetWrapper.DragFileDrop += dropTargetWrapper_DragFileDrop;
     dropTargetWrapper.DragDropEnd += dropTargetWrapper_DragDropEnd;
     try {
         miUnselect = typeof(ToolStripItem).GetMethod("Unselect", BindingFlags.NonPublic | BindingFlags.Instance);
     }
     catch {
     }
 }
Ejemplo n.º 5
0
 private void InstallHooks() {
     hookProc_Key = new HookProc(CallbackKeyboardProc);
     hookProc_Mouse = new HookProc(CallbackMouseProc);
     hookProc_GetMsg = new HookProc(CallbackGetMsgProc);
     int currentThreadId = PInvoke.GetCurrentThreadId();
     hHook_Key = PInvoke.SetWindowsHookEx(2, hookProc_Key, IntPtr.Zero, currentThreadId);
     hHook_Mouse = PInvoke.SetWindowsHookEx(7, hookProc_Mouse, IntPtr.Zero, currentThreadId);
     hHook_Msg = PInvoke.SetWindowsHookEx(3, hookProc_GetMsg, IntPtr.Zero, currentThreadId);
     explorerController = new NativeWindowController(ExplorerHandle);
     explorerController.MessageCaptured += explorerController_MessageCaptured;
     if(ReBarHandle != IntPtr.Zero) {
         rebarController = new NativeWindowController(ReBarHandle);
         rebarController.MessageCaptured += rebarController_MessageCaptured;
         if(QTUtility.CheckConfig(Settings.ToolbarBGColor)) {
             if(QTUtility.DefaultRebarCOLORREF == -1) {
                 QTUtility.DefaultRebarCOLORREF = (int)PInvoke.SendMessage(ReBarHandle, 0x414, IntPtr.Zero, IntPtr.Zero);
             }
             int num2 = QTUtility2.MakeCOLORREF(QTUtility.RebarBGColor);
             PInvoke.SendMessage(ReBarHandle, 0x413, IntPtr.Zero, (IntPtr)num2);
         }
     }
     if(!QTUtility.IsXP) {
         TravelToolBarHandle = GetTravelToolBarWindow32();
         if(TravelToolBarHandle != IntPtr.Zero) {
             travelBtnController = new NativeWindowController(TravelToolBarHandle);
             travelBtnController.MessageCaptured += travelBtnController_MessageCaptured;
         }
     }
     dropTargetWrapper = new DropTargetWrapper(this);
     dropTargetWrapper.DragFileEnter += dropTargetWrapper_DragFileEnter;
     dropTargetWrapper.DragFileOver += dropTargetWrapper_DragFileOver;
     dropTargetWrapper.DragFileLeave += dropTargetWrapper_DragFileLeave;
     dropTargetWrapper.DragFileDrop += dropTargetWrapper_DragFileDrop;
 }
Ejemplo n.º 6
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");
     }
 }
Ejemplo n.º 7
0
 public override void CloseDW(uint dwReserved)
 {
     try {
         if(shellContextMenu != null) {
             shellContextMenu.Dispose();
             shellContextMenu = null;
         }
         foreach(IntPtr ptr in lstPUITEMIDCHILD) {
             if(ptr != IntPtr.Zero) {
                 PInvoke.CoTaskMemFree(ptr);
             }
         }
         if(dropTargetWrapper != null) {
             dropTargetWrapper.Dispose();
             dropTargetWrapper = null;
         }
         InstanceManager.UnregisterButtonBar();
         fFinalRelease = false;
         base.CloseDW(dwReserved);
     }
     catch(Exception exception) {
         QTUtility2.MakeErrorLog(exception, "buttonbar closing");
     }
 }
Ejemplo n.º 8
0
        protected override void OnExplorerAttached()
        {
            ExplorerHandle = (IntPtr)Explorer.HWND;
            InstanceManager.RegisterButtonBar(this);
            dropTargetWrapper = new DropTargetWrapper(this);
            QTTabBarClass tabBar = InstanceManager.GetThreadTabBar();

            // If the TabBar and its PluginManager already exist, that means
            // the ButtonBar must have been closed when the Explorer window
            // opened, so we won't get an initialization message.  Do
            // initialization now.
            if(tabBar != null && tabBar.pluginServer != null) {
                // todo check
                CreateItems();
            }
        }
Ejemplo n.º 9
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");
     }
 }
Ejemplo n.º 10
0
 private void InstallHooks() {
     this.hookProc_Key = new HookProc(this.CallbackKeyboardProc);
     this.hookProc_Mouse = new HookProc(this.CallbackMouseProc);
     this.hookProc_GetMsg = new HookProc(this.CallbackGetMsgProc);
     int currentThreadId = PInvoke.GetCurrentThreadId();
     this.hHook_Key = PInvoke.SetWindowsHookEx(2, this.hookProc_Key, IntPtr.Zero, currentThreadId);
     this.hHook_Mouse = PInvoke.SetWindowsHookEx(7, this.hookProc_Mouse, IntPtr.Zero, currentThreadId);
     this.hHook_Msg = PInvoke.SetWindowsHookEx(3, this.hookProc_GetMsg, IntPtr.Zero, currentThreadId);
     this.explorerController = new NativeWindowController(this.ExplorerHandle);
     this.explorerController.MessageCaptured += new NativeWindowController.MessageEventHandler(this.explorerController_MessageCaptured);
     if(base.ReBarHandle != IntPtr.Zero) {
         this.rebarController = new NativeWindowController(base.ReBarHandle);
         this.rebarController.MessageCaptured += new NativeWindowController.MessageEventHandler(this.rebarController_MessageCaptured);
         if(QTUtility.CheckConfig(Settings.ToolbarBGColor)) {
             if(QTUtility.DefaultRebarCOLORREF == -1) {
                 QTUtility.DefaultRebarCOLORREF = (int)PInvoke.SendMessage(base.ReBarHandle, 0x414, IntPtr.Zero, IntPtr.Zero);
             }
             int num2 = QTUtility2.MakeCOLORREF(QTUtility.RebarBGColor);
             PInvoke.SendMessage(base.ReBarHandle, 0x413, IntPtr.Zero, (IntPtr)num2);
         }
     }
     if(QTUtility.IsVista) {
         this.TravelToolBarHandle = this.GetTravelToolBarWindow32();
         if(this.TravelToolBarHandle != IntPtr.Zero) {
             this.travelBtnController = new NativeWindowController(this.TravelToolBarHandle);
             this.travelBtnController.MessageCaptured += new NativeWindowController.MessageEventHandler(this.travelBtnController_MessageCaptured);
         }
     }
     this.dropTargetWrapper = new DropTargetWrapper(this);
     this.dropTargetWrapper.DragFileEnter += new DropTargetWrapper.DragFileEnterEventHandler(this.dropTargetWrapper_DragFileEnter);
     this.dropTargetWrapper.DragFileOver += new DragEventHandler(this.dropTargetWrapper_DragFileOver);
     this.dropTargetWrapper.DragFileLeave += new EventHandler(this.dropTargetWrapper_DragFileLeave);
     this.dropTargetWrapper.DragFileDrop += new DropTargetWrapper.DragFileDropEventHandler(this.dropTargetWrapper_DragFileDrop);
 }
Ejemplo n.º 11
0
 private void InstallHooks()
 {
     hookProc_Key = new HookProc(CallbackKeyboardProc);
     hookProc_Mouse = new HookProc(CallbackMouseProc);
     hookProc_GetMsg = new HookProc(CallbackGetMsgProc);
     int currentThreadId = PInvoke.GetCurrentThreadId();
     hHook_Key = PInvoke.SetWindowsHookEx(2, hookProc_Key, IntPtr.Zero, currentThreadId);
     hHook_Mouse = PInvoke.SetWindowsHookEx(7, hookProc_Mouse, IntPtr.Zero, currentThreadId);
     hHook_Msg = PInvoke.SetWindowsHookEx(3, hookProc_GetMsg, IntPtr.Zero, currentThreadId);
     explorerController = new NativeWindowController(ExplorerHandle);
     explorerController.MessageCaptured += explorerController_MessageCaptured;
     if(ReBarHandle != IntPtr.Zero) {
         rebarController = new RebarController(this, ReBarHandle, BandObjectSite as IOleCommandTarget);
     }
     if(!QTUtility.IsXP) {
         TravelToolBarHandle = GetTravelToolBarWindow32();
         if(TravelToolBarHandle != IntPtr.Zero) {
             travelBtnController = new NativeWindowController(TravelToolBarHandle);
             travelBtnController.MessageCaptured += travelBtnController_MessageCaptured;
         }
     }
     dropTargetWrapper = new DropTargetWrapper(this);
     dropTargetWrapper.DragFileEnter += dropTargetWrapper_DragFileEnter;
     dropTargetWrapper.DragFileOver += dropTargetWrapper_DragFileOver;
     dropTargetWrapper.DragFileLeave += dropTargetWrapper_DragFileLeave;
     dropTargetWrapper.DragFileDrop += dropTargetWrapper_DragFileDrop;
 }
Ejemplo n.º 12
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");
            }
        }
Ejemplo n.º 13
0
 protected override void OnExplorerAttached() {
     this.ExplorerHandle = (IntPtr)base.Explorer.HWND;
     QTUtility.instanceManager.AddButtonBarHandle(this.ExplorerHandle, base.Handle);
     this.dropTargetWrapper = new DropTargetWrapper(this);
     if(fNoSettings) {
         if(this.pluginManager == null) {
             QTTabBarClass tabBar = QTUtility.instanceManager.GetTabBar(this.ExplorerHandle);
             if(tabBar != null) {
                 this.pluginManager = tabBar.PluginServerInstance;
                 if(this.pluginManager != null) {
                     this.pluginManager.AddRef();
                 }
             }
             this.CreateItems(false);
         }
         fNoSettings = false;
     }
 }