// We need to use a callback rather than a message for window capturing, // since the main instance could be in another process. private static bool NewWindow(IntPtr pIDL) { byte[] IDL; using (IDLWrapper wrapper = new IDLWrapper(PInvoke.ILClone(pIDL))) { if (!Config.Window.CaptureNewWindows || InstanceManager.GetTotalInstanceCount() == 0 || QTUtility2.IsShellPathButNotFileSystem(wrapper.Path) || wrapper.Path.PathEquals(QTUtility.PATH_SEARCHFOLDER) || QTUtility.NoCapturePathsList.Any(path => wrapper.Path.PathEquals(path)) || (Control.ModifierKeys & Keys.Control) != Keys.None) { return(false); } IDL = wrapper.IDL; } InstanceManager.BeginInvokeMain(tabbar => { using (IDLWrapper wrapper = new IDLWrapper(IDL)) { tabbar.OpenNewTabOrWindow(wrapper, true); } }); return(true); }