public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite) { this.tabbar = tabbar; this.bandObjectSite = bandObjectSite; ExplorerHandle = PInvoke.GetAncestor(hwndReBar, 2); Handle = hwndReBar; rebarController = new NativeWindowController(hwndReBar); rebarController.MessageCaptured += RebarMessageCaptured; REBARBANDINFO structure = new REBARBANDINFO(); structure.cbSize = Marshal.SizeOf(structure); structure.fMask = RBBIM.CHILD | RBBIM.ID; int num = (int)PInvoke.SendMessage(Handle, RB.GETBANDCOUNT, IntPtr.Zero, IntPtr.Zero); for(int i = 0; i < num; i++) { PInvoke.SendMessage(Handle, RB.GETBANDINFO, (IntPtr)i, ref structure); if(PInvoke.GetClassName(structure.hwndChild) == "ToolbarWindow32" && structure.wID == 1) { menuController = new NativeWindowController(structure.hwndChild); menuController.MessageCaptured += MenuMessageCaptured; break; } } if(Config.Skin.UseRebarBGColor) { if(DefaultRebarCOLORREF == -1) { DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero); } int num2 = QTUtility2.MakeCOLORREF(Config.Skin.RebarColor); PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2); } EnsureMenuBarIsCorrect(); }
public BreadcrumbBar(IntPtr hwnd) { BreadcrumbController = new NativeWindowController(hwnd); BreadcrumbController.MessageCaptured += BreadcrumbController_MessageCaptured; ParentController = new NativeWindowController(PInvoke.GetParent(hwnd)); ParentController.MessageCaptured += ParentController_MessageCaptured; }
internal ExtendedListViewCommon(ShellBrowserEx shellBrowser, IntPtr hwndShellView, IntPtr hwndListView, IntPtr hwndSubDirTipMessageReflect) { ShellBrowser = shellBrowser; this.hwndSubDirTipMessageReflect = hwndSubDirTipMessageReflect; ListViewController = new NativeWindowController(hwndListView); ListViewController.MessageCaptured += ListViewController_MessageCaptured; ShellViewController = new NativeWindowController(hwndShellView); ShellViewController.MessageCaptured += ShellViewController_MessageCaptured; TRACKMOUSEEVENT structure = new TRACKMOUSEEVENT(); structure.cbSize = Marshal.SizeOf(structure); structure.dwFlags = 2; structure.hwndTrack = ListViewController.Handle; PInvoke.TrackMouseEvent(ref structure); timer_HoverSubDirTipMenu = new Timer(); timer_HoverSubDirTipMenu.Interval = SystemInformation.MouseHoverTime * 6 / 5; timer_HoverSubDirTipMenu.Tick += timer_HoverSubDirTipMenu_Tick; hwndExplorer = PInvoke.GetAncestor(hwndShellView, 3 /* GA_ROOTOWNER */); // If we're late to the party, we'll have to get the IDropTarget the // old-fashioned way. Careful! Calling RegisterDragDrop will go // through the hook! IntPtr ptr = PInvoke.GetProp(hwndListView, "OleDropTargetInterface"); dropTargetPassthrough = TryMakeDTPassthrough(ptr); if (dropTargetPassthrough != null) { PInvoke.RevokeDragDrop(hwndListView); PInvoke.RegisterDragDrop(hwndListView, dropTargetPassthrough); } }
public TreeViewWrapper(IntPtr hwnd, INameSpaceTreeControl treeControl) { this.treeControl = treeControl; treeController = new NativeWindowController(hwnd); treeController.MessageCaptured += TreeControl_MessageCaptured; parentController = new NativeWindowController(PInvoke.GetParent(hwnd)); parentController.MessageCaptured += ParentControl_MessageCaptured; }
internal ExtendedListViewCommon(ShellBrowserEx shellBrowser, IntPtr hwndShellView, IntPtr hwndListView, IntPtr hwndSubDirTipMessageReflect) { ShellBrowser = shellBrowser; this.hwndSubDirTipMessageReflect = hwndSubDirTipMessageReflect; ListViewController = new NativeWindowController(hwndListView); ListViewController.MessageCaptured += ListViewController_MessageCaptured; ShellViewController = new NativeWindowController(hwndShellView); ShellViewController.MessageCaptured += ShellViewController_MessageCaptured; TRACKMOUSEEVENT structure = new TRACKMOUSEEVENT(); structure.cbSize = Marshal.SizeOf(structure); structure.dwFlags = 2; structure.hwndTrack = ListViewController.Handle; PInvoke.TrackMouseEvent(ref structure); timer_HoverSubDirTipMenu = new Timer(); timer_HoverSubDirTipMenu.Interval = SystemInformation.MouseHoverTime * 6 / 5; timer_HoverSubDirTipMenu.Tick += timer_HoverSubDirTipMenu_Tick; hwndExplorer = PInvoke.GetAncestor(hwndShellView, 3 /* GA_ROOTOWNER */); // If we're late to the party, we'll have to get the IDropTarget the // old-fashioned way. Careful! Calling RegisterDragDrop will go // through the hook! IntPtr ptr = PInvoke.GetProp(hwndListView, "OleDropTargetInterface"); dropTargetPassthrough = TryMakeDTPassthrough(ptr); if(dropTargetPassthrough != null) { PInvoke.RevokeDragDrop(hwndListView); PInvoke.RegisterDragDrop(hwndListView, dropTargetPassthrough); } }
public BreadcrumbBar(IntPtr hwnd) { BandObjectLib.Logging.Add_DEBUG("Constructor.log", "BreadcrumbBar"); BreadcrumbController = new NativeWindowController(hwnd); BreadcrumbController.MessageCaptured += BreadcrumbController_MessageCaptured; ParentController = new NativeWindowController(PInvoke.GetParent(hwnd)); ParentController.MessageCaptured += ParentController_MessageCaptured; }
public TreeViewWrapper(IntPtr hwnd, INameSpaceTreeControl treeControl) { BandObjectLib.Logging.Add_DEBUG("Constructor.log", "TreeViewWrapper"); this.treeControl = treeControl; treeController = new NativeWindowController(hwnd); treeController.MessageCaptured += TreeControl_MessageCaptured; parentController = new NativeWindowController(PInvoke.GetParent(hwnd)); parentController.MessageCaptured += ParentControl_MessageCaptured; }
internal ListViewMonitor(ShellBrowserEx shellBrowser, IntPtr hwndExplorer, IntPtr hwndSubDirTipMessageReflect) { ShellBrowser = shellBrowser; this.hwndExplorer = hwndExplorer; this.hwndSubDirTipMessageReflect = hwndSubDirTipMessageReflect; hwndShellContainer = QTUtility.IsXP ? hwndExplorer : WindowUtils.FindChildWindow(hwndExplorer, hwnd => PInvoke.GetClassName(hwnd) == "ShellTabWindowClass"); if(hwndShellContainer != IntPtr.Zero) { ContainerController = new NativeWindowController(hwndShellContainer); ContainerController.MessageCaptured += ContainerController_MessageCaptured; } }
internal ListViewMonitor(ShellBrowserEx shellBrowser, IntPtr hwndExplorer, IntPtr hwndSubDirTipMessageReflect) { ShellBrowser = shellBrowser; this.hwndExplorer = hwndExplorer; this.hwndSubDirTipMessageReflect = hwndSubDirTipMessageReflect; hwndShellContainer = QTUtility.IsXP ? hwndExplorer : WindowUtils.FindChildWindow(hwndExplorer, hwnd => PInvoke.GetClassName(hwnd) == "ShellTabWindowClass"); if (hwndShellContainer != IntPtr.Zero) { ContainerController = new NativeWindowController(hwndShellContainer); ContainerController.MessageCaptured += ContainerController_MessageCaptured; } }
internal ListViewMonitor(ShellBrowserEx shellBrowser, IntPtr hwndExplorer, IntPtr hwndSubDirTipMessageReflect) { ShellBrowser = shellBrowser; this.hwndExplorer = hwndExplorer; this.hwndSubDirTipMessageReflect = hwndSubDirTipMessageReflect; if(!QTUtility.IsXP) { hwndEnumResult = IntPtr.Zero; PInvoke.EnumChildWindows(hwndExplorer, CallbackEnumChildProc_Container, IntPtr.Zero); hwndShellContainer = hwndEnumResult; } else { hwndShellContainer = hwndExplorer; } if(hwndShellContainer != IntPtr.Zero) { ContainerController = new NativeWindowController(hwndShellContainer); ContainerController.MessageCaptured += ContainerController_MessageCaptured; } }
private void OnFileRename(IDLWrapper idl) { if (!idl.Available || idl.IsFolder) { return; } string path = idl.Path; if (File.Exists(path)) { string extension = Path.GetExtension(path); if (!string.IsNullOrEmpty(extension) && (extension.Equals(".lnk", StringComparison.OrdinalIgnoreCase) || extension.Equals(".url", StringComparison.OrdinalIgnoreCase))) { return; } } IntPtr hWnd = GetEditControl(); if (hWnd == IntPtr.Zero) { return; } IntPtr lParam = Marshal.AllocHGlobal(520); if ((int)PInvoke.SendMessage(hWnd, WM.GETTEXT, (IntPtr)260, lParam) > 0) { string str3 = Marshal.PtrToStringUni(lParam); if (str3.Length > 2) { int num = str3.LastIndexOf("."); if (num > 0) { // Explorer will send the EM_SETSEL message to select the // entire filename. We will intercept this message and // change the params to select only the part before the // extension. EditController = new NativeWindowController(hWnd); EditController.OptionalHandle = (IntPtr)num; EditController.MessageCaptured += EditController_MessageCaptured; } } } Marshal.FreeHGlobal(lParam); }
public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite) { this.tabbar = tabbar; this.bandObjectSite = bandObjectSite; ExplorerHandle = PInvoke.GetAncestor(hwndReBar, 2); Handle = hwndReBar; rebarController = new NativeWindowController(hwndReBar); rebarController.MessageCaptured += MessageCaptured; if(QTUtility.CheckConfig(Settings.ToolbarBGColor)) { if(QTUtility.DefaultRebarCOLORREF == -1) { QTUtility.DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero); } int num2 = QTUtility2.MakeCOLORREF(QTUtility.RebarBGColor); PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2); } EnsureMenuBarIsCorrect(); }
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); }
public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite) { this.tabbar = tabbar; this.bandObjectSite = bandObjectSite; ExplorerHandle = PInvoke.GetAncestor(hwndReBar, 2); Handle = hwndReBar; rebarController = new NativeWindowController(hwndReBar); rebarController.MessageCaptured += MessageCaptured; if (QTUtility.CheckConfig(Settings.ToolbarBGColor)) { if (QTUtility.DefaultRebarCOLORREF == -1) { QTUtility.DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero); } int num2 = QTUtility2.MakeCOLORREF(QTUtility.RebarBGColor); PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2); } EnsureMenuBarIsCorrect(); }
internal ListViewMonitor(ShellBrowserEx shellBrowser, IntPtr hwndExplorer, IntPtr hwndSubDirTipMessageReflect) { ShellBrowser = shellBrowser; this.hwndExplorer = hwndExplorer; this.hwndSubDirTipMessageReflect = hwndSubDirTipMessageReflect; if (!QTUtility.IsXP) { hwndEnumResult = IntPtr.Zero; PInvoke.EnumChildWindows(hwndExplorer, CallbackEnumChildProc_Container, IntPtr.Zero); hwndShellContainer = hwndEnumResult; } else { hwndShellContainer = hwndExplorer; } if (hwndShellContainer != IntPtr.Zero) { ContainerController = new NativeWindowController(hwndShellContainer); ContainerController.MessageCaptured += ContainerController_MessageCaptured; } }
public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite) { BandObjectLib.Logging.Add_DEBUG("Constructor.log", "RebarController"); this.tabbar = tabbar; this.bandObjectSite = bandObjectSite; ExplorerHandle = PInvoke.GetAncestor(hwndReBar, 2); Handle = hwndReBar; rebarController = new NativeWindowController(hwndReBar); rebarController.MessageCaptured += RebarMessageCaptured; REBARBANDINFO structure = new REBARBANDINFO(); structure.cbSize = Marshal.SizeOf(structure); structure.fMask = RBBIM.CHILD | RBBIM.ID; int num = (int)PInvoke.SendMessage(Handle, RB.GETBANDCOUNT, IntPtr.Zero, IntPtr.Zero); for (int i = 0; i < num; i++) { PInvoke.SendMessage(Handle, RB.GETBANDINFO, (IntPtr)i, ref structure); if (PInvoke.GetClassName(structure.hwndChild) == "ToolbarWindow32" && structure.wID == 1) { menuController = new NativeWindowController(structure.hwndChild); menuController.MessageCaptured += MenuMessageCaptured; break; } } if (Config.Skin.UseRebarBGColor) { if (DefaultRebarCOLORREF == -1) { DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero); } int num2 = QTUtility2.MakeCOLORREF(Config.Skin.RebarColor); PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2); } EnsureMenuBarIsCorrect(); }
internal ExtendedListViewCommon(ShellBrowserEx shellBrowser, IntPtr hwndShellView, IntPtr hwndListView, IntPtr hwndSubDirTipMessageReflect) { ShellBrowser = shellBrowser; this.hwndSubDirTipMessageReflect = hwndSubDirTipMessageReflect; ListViewController = new NativeWindowController(hwndListView); ListViewController.MessageCaptured += ListViewController_MessageCaptured; ShellViewController = new NativeWindowController(hwndShellView); ShellViewController.MessageCaptured += ShellViewController_MessageCaptured; TRACKMOUSEEVENT structure = new TRACKMOUSEEVENT(); structure.cbSize = Marshal.SizeOf(structure); structure.dwFlags = 2; structure.hwndTrack = ListViewController.Handle; PInvoke.TrackMouseEvent(ref structure); timer_HoverSubDirTipMenu = new Timer(); timer_HoverSubDirTipMenu.Interval = SystemInformation.MouseHoverTime * 6 / 5; timer_HoverSubDirTipMenu.Tick += timer_HoverSubDirTipMenu_Tick; hwndExplorer = PInvoke.GetAncestor(hwndShellView, 3 /* GA_ROOTOWNER */); HookDropTarget(); }
private bool ShellViewController_MessageCaptured(ref System.Windows.Forms.Message msg) { IntPtr ptr; switch(msg.Msg) { // The ShellView is destroyed and recreated when Explorer is refreshed. case WM.DESTROY: if(SVDestroy != null) { ShellViewController.ReleaseHandle(); ShellViewController = null; return SVDestroy(); } break; case WM.MOUSEACTIVATE: if(SVMouseActivate != null) { int res = (int)msg.Result; bool ret = SVMouseActivate(ref res); msg.Result = (IntPtr)res; return ret; } break; /* fEnteredMenuLoop is used nowhere... Unfinished feature? case WM.ENTERMENULOOP: this.fEnteredMenuLoop = true; break; case WM.EXITMENULOOP: this.fEnteredMenuLoop = false; break; */ } if(msg.Msg != WM.NOTIFY) { return false; } NMHDR nmhdr = (NMHDR)Marshal.PtrToStructure(msg.LParam, typeof(NMHDR)); if(nmhdr.hwndFrom != ListViewController.Handle) { if(((nmhdr.code == -12 /*NM_CUSTOMDRAW*/) && (nmhdr.idFrom == IntPtr.Zero)) && fTrackMouseEvent) { fTrackMouseEvent = false; TRACKMOUSEEVENT structure = new TRACKMOUSEEVENT(); structure.cbSize = Marshal.SizeOf(structure); structure.dwFlags = 2; /*TME_LEAVE*/ structure.hwndTrack = ListViewController.Handle; PInvoke.TrackMouseEvent(ref structure); } return false; } // Process WM.NOTIFY. These are all notifications from the // SysListView32 control. We will not get ANY of these on // Windows 7, which means every single one of them has to // have an alternative somewhere for the non-SysListView32, // or it's not going to happen. switch(nmhdr.code) { case -12: // NM_CUSTOMDRAW // This is for drawing alternating row colors. I doubt // very much we'll find an alternative for this... return HandleLVCUSTOMDRAW(ref msg); case LVN.ITEMCHANGED: { // There are three things happening here. // 1. Notify plugins of selection changing: TODO // 2. Redraw for Full Row Select: Not happening // 3. Set new item DropHilighted: Handled in the ListView // Controller. if(QTUtility.instanceManager.TryGetButtonBarHandle(this.ExplorerHandle, out ptr)) { QTUtility2.SendCOPYDATASTRUCT(ptr, (IntPtr)13, null, (IntPtr)GetItemCount()); } bool flag = QTUtility.IsVista && QTUtility.CheckConfig(Settings.NoFullRowSelect); if(DropHilighted != null || SelectionChanged != null || flag) { NMLISTVIEW nmlistview2 = (NMLISTVIEW)Marshal.PtrToStructure(msg.LParam, typeof(NMLISTVIEW)); if(nmlistview2.uChanged == 8 /*LVIF_STATE*/) { uint num5 = nmlistview2.uNewState & LVIS.SELECTED; uint num6 = nmlistview2.uOldState & LVIS.SELECTED; uint num7 = nmlistview2.uNewState & LVIS.DROPHILITED; uint num8 = nmlistview2.uOldState & LVIS.DROPHILITED; uint num9 = nmlistview2.uNewState & LVIS.CUT; uint num10 = nmlistview2.uOldState & LVIS.CUT; if(DropHilighted != null && (num8 != num7)) { if(num7 == 0) { DropHilighted(-1); } else { DropHilighted(nmlistview2.iItem); } } if(flag) { if(nmlistview2.iItem != -1 && ((num5 != num6) || (num7 != num8) || (num9 != num10)) && GetCurrentViewMode() == FVM.DETAILS) { PInvoke.SendMessage(nmlistview2.hdr.hwndFrom, LVM.REDRAWITEMS, (IntPtr)nmlistview2.iItem, (IntPtr)nmlistview2.iItem); } } if(SelectionChanged != null && num5 != num6) { SelectionChanged(); } } } break; } case LVN.INSERTITEM: ItemInserted(); if(QTUtility.CheckConfig(Settings.AlternateRowColors) && (GetCurrentViewMode() == FVM.DETAILS)) { PInvoke.InvalidateRect(nmhdr.hwndFrom, IntPtr.Zero, true); } break; case LVN.DELETEITEM: ItemDeleted(); if(QTUtility.CheckConfig(Settings.AlternateRowColors) && (GetCurrentViewMode() == FVM.DETAILS)) { PInvoke.InvalidateRect(nmhdr.hwndFrom, IntPtr.Zero, true); } break; case LVN.DELETEALLITEMS: if(AllItemsDeleted != null) return AllItemsDeleted(); break; case LVN.BEGINDRAG: if(BeginDrag != null) { ShellViewController.DefWndProc(ref msg); BeginDrag(); return true; } break; case LVN.ITEMACTIVATE: if(ItemActivated != null) { NMITEMACTIVATE nmitemactivate = (NMITEMACTIVATE)Marshal.PtrToStructure(msg.LParam, typeof(NMITEMACTIVATE)); Keys modKeys = (((nmitemactivate.uKeyFlags & 1) == 1) ? Keys.Alt : Keys.None) | (((nmitemactivate.uKeyFlags & 2) == 2) ? Keys.Control : Keys.None) | (((nmitemactivate.uKeyFlags & 4) == 4) ? Keys.Shift : Keys.None); if(ItemActivated(modKeys)) return true; } break; case LVN.ODSTATECHANGED: // FullRowSelect doesn't look possible anyway, so whatever. if(QTUtility.IsVista && QTUtility.CheckConfig(Settings.NoFullRowSelect)) { NMLVODSTATECHANGE nmlvodstatechange = (NMLVODSTATECHANGE)Marshal.PtrToStructure(msg.LParam, typeof(NMLVODSTATECHANGE)); if(((nmlvodstatechange.uNewState & 2) == 2) && (GetCurrentViewMode() == FVM.DETAILS)) { PInvoke.SendMessage(nmlvodstatechange.hdr.hwndFrom, LVM.REDRAWITEMS, (IntPtr)nmlvodstatechange.iFrom, (IntPtr)nmlvodstatechange.iTo); } } break; case LVN.HOTTRACK: // This will be handled through WM_MOUSEMOVE. if(HotTrack != null) { NMLISTVIEW nmlistview = (NMLISTVIEW)Marshal.PtrToStructure(msg.LParam, typeof(NMLISTVIEW)); HotTrack(nmlistview.iItem); break; } break; case LVN.KEYDOWN: // This will be handled through WM_KEYDOWN. if(KeyDown != null) { NMLVKEYDOWN nmlvkeydown = (NMLVKEYDOWN)Marshal.PtrToStructure(msg.LParam, typeof(NMLVKEYDOWN)); if(KeyDown((Keys)nmlvkeydown.wVKey)) { msg.Result = (IntPtr)1; return true; } else { return false; } } break; case LVN.GETINFOTIP: if(GetInfoTip != null) { NMLVGETINFOTIP nmlvgetinfotip = (NMLVGETINFOTIP)Marshal.PtrToStructure(msg.LParam, typeof(NMLVGETINFOTIP)); return GetInfoTip(nmlvgetinfotip.iItem, GetHotItem() != nmlvgetinfotip.iItem); // TODO there's got to be a better way. } break; case LVN.BEGINLABELEDIT: // This is just for file renaming, which there's no need to // mess with in Windows 7. ShellViewController.DefWndProc(ref msg); if(msg.Result == IntPtr.Zero && BeginLabelEdit != null) { NMLVDISPINFO nmlvdispinfo = (NMLVDISPINFO)Marshal.PtrToStructure(msg.LParam, typeof(NMLVDISPINFO)); BeginLabelEdit(nmlvdispinfo.item); } break; case LVN.ENDLABELEDIT: if(EndLabelEdit != null) { NMLVDISPINFO nmlvdispinfo2 = (NMLVDISPINFO)Marshal.PtrToStructure(msg.LParam, typeof(NMLVDISPINFO)); EndLabelEdit(nmlvdispinfo2.item); } break; case LVN.BEGINSCROLL: // This we can handle by intercepting SBM_SETSCROLLINFO // when it's sent to the scrollbars. if(BeginScroll != null) { return BeginScroll(); } break; } return false; }
void RecaptureHandles(IntPtr hwndShellView) { if(ShellViewController != null) { ShellViewController.ReleaseHandle(); ShellViewController = null; } if(ListViewController != null) { ListViewController.ReleaseHandle(); ListViewController = null; } ShellViewController = new NativeWindowController(hwndShellView); ShellViewController.MessageCaptured += new NativeWindowController.MessageEventHandler(ShellViewController_MessageCaptured); hwndEnumResult = IntPtr.Zero; PInvoke.EnumChildWindows(hwndShellView, new EnumWndProc(this.CallbackEnumChildProc_ListView), IntPtr.Zero); if(hwndEnumResult == IntPtr.Zero) { return; } ListViewController = new NativeWindowController(hwndEnumResult); ListViewController.MessageCaptured += new NativeWindowController.MessageEventHandler(ListViewController_MessageCaptured); if(fIsSysListView) { uint mask = LVS_EX.GRIDLINES | LVS_EX.FULLROWSELECT; uint flags = 0; if(QTUtility.CheckConfig(Settings.DetailsGridLines)) { flags |= LVS_EX.GRIDLINES; } if(QTUtility.IsVista) { if(!QTUtility.CheckConfig(Settings.NoFullRowSelect)) { flags |= LVS_EX.FULLROWSELECT; } } else if(QTUtility.CheckConfig(Settings.NoFullRowSelect)) { if(((int)PInvoke.SendMessage(ListViewController.Handle, LVM.GETVIEW, IntPtr.Zero, IntPtr.Zero)) == 1) { flags |= LVS_EX.FULLROWSELECT; } } PInvoke.SendMessage(ListViewController.Handle, LVM.SETEXTENDEDLISTVIEWSTYLE, (IntPtr)mask, (IntPtr)flags); } else { //using(IDLWrapper wrapper = new IDLWrapper(ShellMethods.ShellGetPath(this.ShellBrowser))) { // if(wrapper.IsFileSystem) { AutoMan.RegisterSelChangedEvent(ListViewController.Handle, CallbackSelChanged); // } //} } this.fTrackMouseEvent = false; TRACKMOUSEEVENT structure = new TRACKMOUSEEVENT(); structure.cbSize = Marshal.SizeOf(structure); structure.dwFlags = 2; structure.hwndTrack = ListViewController.Handle; PInvoke.TrackMouseEvent(ref structure); }
internal event MouseLeaveHandler MouseLeave; // SysListView Only internal ListViewWrapper(IShellBrowser ShellBrowser, IntPtr ExplorerHandle) { this.ShellBrowser = ShellBrowser; this.ExplorerHandle = ExplorerHandle; AutoMan = new AutomationManager(); if(QTUtility.IsVista) { hwndEnumResult = IntPtr.Zero; PInvoke.EnumChildWindows(ExplorerHandle, new EnumWndProc(this.CallbackEnumChildProc_Container), IntPtr.Zero); ShellContainer = hwndEnumResult; } else { ShellContainer = ExplorerHandle; } if(ShellContainer != IntPtr.Zero) { ContainerController = new NativeWindowController(ShellContainer); ContainerController.MessageCaptured += new NativeWindowController.MessageEventHandler(ContainerController_MessageCaptured); } Initialize(); }
private bool ListViewController_MessageCaptured(ref System.Windows.Forms.Message msg) { // First block is for both SysListView and ItemsView switch(msg.Msg) { case WM.DESTROY: ListViewController.ReleaseHandle(); ListViewController = null; break; case WM.MOUSEMOVE: if(this.fTrackMouseEvent) { this.fTrackMouseEvent = false; TRACKMOUSEEVENT structure = new TRACKMOUSEEVENT(); structure.cbSize = Marshal.SizeOf(structure); structure.dwFlags = 2; structure.hwndTrack = msg.HWnd; PInvoke.TrackMouseEvent(ref structure); } break; case WM.LBUTTONDBLCLK: if(DoubleClick != null) { return DoubleClick(new Point( QTUtility2.GET_X_LPARAM(msg.LParam), QTUtility2.GET_Y_LPARAM(msg.LParam))); } break; case WM.MBUTTONUP: if(MiddleClick != null) { MiddleClick(new Point( QTUtility2.GET_X_LPARAM(msg.LParam), QTUtility2.GET_Y_LPARAM(msg.LParam))); } break; case WM.MOUSELEAVE: fTrackMouseEvent = true; if(MouseLeave != null) return MouseLeave(); break; } // From here on down is only for the ItemsView. if(fIsSysListView) { return false; } switch(msg.Msg) { case WM.LBUTTONDOWN: // The ItemsView's window class doesn't have the CS_DBLCLKS // class style, which means we won't be receiving the // WM.LBUTTONDBLCLK message. We'll just have to make do // without... if(DoubleClick != null || ItemActivated != null) { Int64 now = DateTime.Now.Ticks; Point pt = new Point( QTUtility2.GET_X_LPARAM(msg.LParam), QTUtility2.GET_Y_LPARAM(msg.LParam)); if((now - lastLButtonTime) / 10000 <= SystemInformation.DoubleClickTime) { Size size = SystemInformation.DoubleClickSize; if(Math.Abs(pt.X - lastLButtonPoint.X) <= size.Width) { if(Math.Abs(pt.Y - lastLButtonPoint.Y) <= size.Height) { lastLButtonTime = 0; if(DoubleClick != null && DoubleClick(pt)) { return true; } if(ItemActivated != null) { if(HitTest(pt, false) > -1) { // Explorer includes an option to make // single-clicking activate items. // TODO: Support that. if(ItemActivated(Control.ModifierKeys)) { return true; } } } return false; } } } lastLButtonPoint = pt; lastLButtonTime = now; } return false; case WM.MOUSEMOVE: if(HotTrack != null) { Point pt = new Point(QTUtility2.GET_X_LPARAM(msg.LParam), QTUtility2.GET_Y_LPARAM(msg.LParam)); if(pt != lastMouseMovePoint) { lastMouseMovePoint = pt; return HotTrack(HitTest(pt, false)); } } break; case WM.KEYDOWN: if(KeyDown != null && KeyDown((Keys)msg.WParam)) return true; if((Keys)msg.WParam == Keys.Enter && ItemActivated != null) { return ItemActivated(Control.ModifierKeys); } break; case WM.USER + 209: // This message appears to control dragging. if(DropHilighted != null) { Point pt = new Point((int)msg.WParam, (int)msg.LParam); if(pt == lastDragPoint) { return false; } lastDragPoint = pt; return DropHilighted(HitTest(pt, false)); } break; case WM.NOTIFY: if(GetInfoTip != null) { NMHDR nmhdr = (NMHDR)Marshal.PtrToStructure(msg.LParam, typeof(NMHDR)); if(nmhdr.code == -530 /* TTN_NEEDTEXT */) { NMTTDISPINFO dispinfo = (NMTTDISPINFO)Marshal.PtrToStructure(msg.LParam, typeof(NMTTDISPINFO)); if((dispinfo.uFlags & 0x20 /* TTF_TRACK */) != 0) { return GetInfoTip(GetFocusedItem(), true); } else { int i = GetHotItem(); if(i != -1 && IsTrackingItemName()) { return GetInfoTip(i, false); } } } } break; } return false; }
public void Initialize() { if(ShellViewController != null) { ShellViewController.ReleaseHandle(); ShellViewController = null; } if(ListViewController != null) { ListViewController.ReleaseHandle(); ListViewController = null; } hwndEnumResult = IntPtr.Zero; PInvoke.EnumChildWindows(ExplorerHandle, new EnumWndProc(this.CallbackEnumChildProc_ShellView), IntPtr.Zero); if(hwndEnumResult != IntPtr.Zero) { RecaptureHandles(hwndEnumResult); } }
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"); } }
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; }
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"); } }
private void OnFileRename(IDLWrapper idl) { if(!idl.Available || idl.IsFileSystemFolder) return; string path = idl.Path; if(File.Exists(path)) { string extension = Path.GetExtension(path); if(!string.IsNullOrEmpty(extension) && extension.PathEquals(".lnk")) { return; } } IntPtr hWnd = GetEditControl(); if(hWnd == IntPtr.Zero) return; using(SafePtr lParam = new SafePtr(520)) { if((int)PInvoke.SendMessage(hWnd, WM.GETTEXT, (IntPtr)260, lParam) <= 0) return; string str3 = Marshal.PtrToStringUni(lParam); if(str3.Length > 2) { int num = str3.LastIndexOf("."); if(num > 0) { // Explorer will send the EM_SETSEL message to select the // entire filename. We will intercept this message and // change the params to select only the part before the // extension. EditController = new NativeWindowController(hWnd); EditController.OptionalHandle = (IntPtr)num; EditController.MessageCaptured += EditController_MessageCaptured; } } } }
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); }
private void InstallDesktopHook() { uint num; IntPtr desktopHwnd = GetDesktopHwnd(); if(this.timerHooks == null) { if(desktopHwnd == IntPtr.Zero) { this.timerHooks = new System.Windows.Forms.Timer(); this.timerHooks.Tick += new EventHandler(this.timerHooks_Tick); this.timerHooks.Interval = 0xbb8; this.timerHooks.Start(); return; } } else { if(desktopHwnd == IntPtr.Zero) { return; } this.timerHooks.Stop(); this.timerHooks.Dispose(); this.timerHooks = null; } this.hwndListView = desktopHwnd; this.hwndShellTray = WindowUtils.GetShellTrayWnd(); this.hookProc_Msg_Desktop = new QTTabBarLib.Interop.HookProc(this.CallbackGetMsgProc_Desktop); this.hookProc_Msg_ShellTrayWnd = new QTTabBarLib.Interop.HookProc(this.CallbackGetMsgProc_ShellTrayWnd); this.hookProc_Keys_Desktop = new QTTabBarLib.Interop.HookProc(this.CallbackKeyProc_Desktop); int windowThreadProcessId = PInvoke.GetWindowThreadProcessId(this.hwndListView, out num); int dwThreadId = PInvoke.GetWindowThreadProcessId(this.hwndShellTray, out this.ProcessID); this.hHook_MsgDesktop = PInvoke.SetWindowsHookEx(3, this.hookProc_Msg_Desktop, IntPtr.Zero, windowThreadProcessId); this.hHook_MsgShell_TrayWnd = PInvoke.SetWindowsHookEx(3, this.hookProc_Msg_ShellTrayWnd, IntPtr.Zero, dwThreadId); this.hHook_KeyDesktop = PInvoke.SetWindowsHookEx(2, this.hookProc_Keys_Desktop, IntPtr.Zero, windowThreadProcessId); PInvoke.PostMessage(this.hwndListView, WM.APP + 100, IntPtr.Zero, IntPtr.Zero); IntPtr windowLongPtr = PInvoke.GetWindowLongPtr(this.hwndListView, -8); if(windowLongPtr != IntPtr.Zero) { this.shellViewController = new NativeWindowController(windowLongPtr); this.shellViewController.OptionalHandle = this.hwndListView; this.shellViewController.MessageCaptured += new NativeWindowController.MessageEventHandler(this.shellViewController_MessageCaptured); } }
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"); } }
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; }
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); }
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); }
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 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); }