public static HashSet <ITravelLogEntry> GetTravelLogEntries(WebBrowser webBrowser) { int HRESULT_OK = 0; SHDocVw.IWebBrowser2 axWebBrowser = (SHDocVw.IWebBrowser2)webBrowser.ActiveXInstance; IServiceProvider psp = axWebBrowser as IServiceProvider; if (psp == null) { throw new Exception("Could not get IServiceProvider."); } IntPtr oret = IntPtr.Zero; int hr = psp.QueryService(ref SID_STravelLogCursor, ref IID_ITravelLogStg, out oret); if ((oret == IntPtr.Zero) || (hr != HRESULT_OK)) { throw new Exception("Failed to query service."); } ITravelLogStg tlstg = Marshal.GetObjectForIUnknown(oret) as ITravelLogStg; if (null == tlstg) { throw new Exception("Failed to get ITravelLogStg"); } //Enum the travel log entries IEnumTravelLogEntry penumtle = null; tlstg.EnumEntries((int)TLMENUF.TLEF_ABSOLUTE, out penumtle); hr = 0; ITravelLogEntry ptle = null; int fetched = 0; const int MAX_FETCH_COUNT = 1; hr = penumtle.Next(MAX_FETCH_COUNT, out ptle, out fetched); Marshal.ThrowExceptionForHR(hr); HashSet <ITravelLogEntry> results = new HashSet <ITravelLogEntry>(); for (int i = 0; 0 == hr; i++) { if (ptle != null) { results.Add(ptle); } hr = penumtle.Next(MAX_FETCH_COUNT, out ptle, out fetched); Marshal.ThrowExceptionForHR(hr); } Marshal.ReleaseComObject(penumtle); Marshal.ReleaseComObject(tlstg); return(results); }
//public static void TravelTo(WebBrowser webBrowser, int public static ITravelLogEntry GetTravelLogEntry(WebBrowser webBrowser) { int HRESULT_OK = 0; SHDocVw.IWebBrowser2 axWebBrowser = (SHDocVw.IWebBrowser2)webBrowser.ActiveXInstance; IServiceProvider psp = axWebBrowser as IServiceProvider; if (psp == null) { throw new Exception("Could not get IServiceProvider."); } IntPtr oret = IntPtr.Zero; int hr = psp.QueryService(ref SID_STravelLogCursor, ref IID_ITravelLogStg, out oret); if ((oret == IntPtr.Zero) || (hr != HRESULT_OK)) { throw new Exception("Failed to query service."); } ITravelLogStg tlstg = Marshal.GetObjectForIUnknown(oret) as ITravelLogStg; if (null == tlstg) { throw new Exception("Failed to get ITravelLogStg"); } ITravelLogEntry ptle = null; hr = tlstg.GetRelativeEntry(0, out ptle); if (hr != HRESULT_OK) { throw new Exception("Failed to get travel log entry with error " + hr.ToString("X")); } Marshal.ReleaseComObject(tlstg); return(ptle); }
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"); } }
protected override void OnExplorerAttached() { ExplorerHandle = (IntPtr)Explorer.HWND; if(QTUtility.CheckConfig(Settings.NoWindowResizing)) { PInvoke.SetWindowLongPtr(ExplorerHandle, -16, PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -16), 0xfffbffff)); } try { object obj2; object obj3; _IServiceProvider bandObjectSite = (_IServiceProvider)BandObjectSite; Guid guid = ExplorerGUIDs.IID_IShellBrowser; Guid riid = ExplorerGUIDs.IID_IUnknown; bandObjectSite.QueryService(ref guid, ref riid, out obj2); ShellBrowser = new ShellBrowserEx((IShellBrowser)obj2); QTUtility.InitShellBrowserHook(ShellBrowser.GetIShellBrowser()); if(QTUtility.CheckConfig(Settings.ForceSysListView)) { ShellBrowser.SetUsingListView(true); } Guid guid3 = ExplorerGUIDs.IID_ITravelLogStg; Guid guid4 = ExplorerGUIDs.IID_ITravelLogStg; bandObjectSite.QueryService(ref guid3, ref guid4, out obj3); TravelLog = (ITravelLogStg)obj3; } catch(COMException exception) { QTUtility2.MakeErrorLog(exception, null); } Explorer.BeforeNavigate2 += Explorer_BeforeNavigate2; Explorer.NavigateComplete2 += Explorer_NavigateComplete2; }
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"); } }
protected override void OnExplorerAttached() { this.ExplorerHandle = (IntPtr)base.Explorer.HWND; if(QTUtility.CheckConfig(Settings.NoWindowResizing)) { PInvoke.SetWindowLongPtr(this.ExplorerHandle, -16, PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(this.ExplorerHandle, -16), 0xfffbffff)); } try { object obj2; object obj3; _IServiceProvider bandObjectSite = (_IServiceProvider)base.BandObjectSite; Guid guid = ExplorerGUIDs.IID_IShellBrowser; Guid riid = ExplorerGUIDs.IID_IUnknown; bandObjectSite.QueryService(ref guid, ref riid, out obj2); this.ShellBrowser = (IShellBrowser)obj2; Guid guid3 = ExplorerGUIDs.IID_ITravelLogStg; Guid guid4 = ExplorerGUIDs.IID_ITravelLogStg; bandObjectSite.QueryService(ref guid3, ref guid4, out obj3); this.TravelLog = (ITravelLogStg)obj3; } catch(COMException exception) { QTUtility2.MakeErrorLog(exception, null); } base.Explorer.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(this.Explorer_BeforeNavigate2); base.Explorer.NavigateComplete2 += new DWebBrowserEvents2_NavigateComplete2EventHandler(this.Explorer_NavigateComplete2); base.Explorer.DownloadBegin += new SHDocVw.DWebBrowserEvents2_DownloadBeginEventHandler(this.Explorer_DownloadBegin); }
private bool GetHistorySession() { if (m_TravelLogStg != null) return true; //QI for serviceprovider IfacesEnumsStructsClasses.IServiceProvider psp = m_WBUnknown as IfacesEnumsStructsClasses.IServiceProvider; if (psp == null) return false; IntPtr oret = IntPtr.Zero; //QueryService for ITravelLogStg int hr = psp.QueryService(ref Iid_Clsids.SID_STravelLogCursor, ref Iid_Clsids.IID_ITravelLogStg, out oret); if ((oret == IntPtr.Zero) || (hr != Hresults.S_OK)) return false; Marshal.ReleaseComObject(psp); m_TravelLogStg = Marshal.GetObjectForIUnknown(oret) as ITravelLogStg; return (m_TravelLogStg != null) ? true : false; }
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"); } }
protected override void OnExplorerAttached() { ExplorerHandle = (IntPtr)Explorer.HWND; try { object obj2; object obj3; _IServiceProvider bandObjectSite = (_IServiceProvider)BandObjectSite; bandObjectSite.QueryService(ExplorerGUIDs.IID_IShellBrowser, ExplorerGUIDs.IID_IUnknown, out obj2); ShellBrowser = new ShellBrowserEx((IShellBrowser)obj2); HookLibManager.InitShellBrowserHook(ShellBrowser.GetIShellBrowser()); if(Config.Tweaks.ForceSysListView) { ShellBrowser.SetUsingListView(true); } bandObjectSite.QueryService(ExplorerGUIDs.IID_ITravelLogStg, ExplorerGUIDs.IID_ITravelLogStg, out obj3); TravelLog = (ITravelLogStg)obj3; } catch(COMException exception) { QTUtility2.MakeErrorLog(exception); } Explorer.BeforeNavigate2 += Explorer_BeforeNavigate2; Explorer.NavigateComplete2 += Explorer_NavigateComplete2; }