private static void MouseHook_MouseDownEvent(object sender, MouseEventArgs e) { hCurrentWindow = WindowFromPoint(e.Location); WindowsInfoHelper.GetTopWindow(ref hCurrentWindow); GetWindowRect(hCurrentWindow, out rectCurrentWindow); WindowsInfoHelper.WindowInfo currentWindow = new WindowsInfoHelper.WindowInfo(hCurrentWindow); foreach (XmlElement xe in xeFilters) { string windowClass = ((XmlElement)xe.SelectSingleNode("WindowClass")).GetAttribute("Text"); string windowTitle = ((XmlElement)xe.SelectSingleNode("WindowTitle")).GetAttribute("Text"); string windowTitleLogic = ((XmlElement)xe.SelectSingleNode("WindowTitle")).GetAttribute("Logic"); string filePath = ((XmlElement)xe.SelectSingleNode("FilePath")).GetAttribute("Text"); if (currentWindow.WindowClass == windowClass && string.Equals(currentWindow.FilePath, filePath, StringComparison.OrdinalIgnoreCase) && ((windowTitleLogic == "Include" && currentWindow.WindowTitle.Contains(windowTitle)) || (windowTitleLogic == "Equal" && currentWindow.WindowTitle == windowTitle))) { shallDock = false; return; } } if (hCurrentWindow == dock.Handle || hCurrentWindow == filter.Handle) { shallDock = false; return; } shallDock = true; }
internal void FillInfo(IntPtr handle) { WindowsInfoHelper.WindowInfo currentWindow = new WindowsInfoHelper.WindowInfo(handle); lblHandle.Text = "句柄:" + currentWindow.Handle; txtWindowTitle.Text = currentWindow.WindowTitle; txtWindowClass.Text = currentWindow.WindowClass; txtFilePath.Text = currentWindow.FilePath; }