} //end CaptureMouse /// <summary> /// Handles all mouse move messages sent to the Spy Window /// </summary> private void HandleMouseMovements() { // if we're not capturing, then bail out if (!_capturing) { return; } try { // capture the window under the cursor's position _hCurrentWindow = User32.WindowFromPoint(Cursor.Position); // if the window we're over, is not the same as the one before, and we had one before, refresh it if (_hPreviousWindow != IntPtr.Zero && _hPreviousWindow != _hCurrentWindow) { WindowHighlighter.Refresh(_hPreviousWindow); } // if we didn't find a window.. that's pretty hard to imagine. lol if (_hCurrentWindow == IntPtr.Zero) { m_txtHandle.Text = ""; m_txtClass.Text = ""; m_txtCaption.Text = ""; m_txtStyle.Text = ""; m_txtRect.Text = ""; } //end if else { // save the window we're over _hPreviousWindow = _hCurrentWindow; m_txtProcess.Text = GetProcessPath(_hCurrentWindow); m_txtHandle.Text = string.Format("{0}", _hCurrentWindow.ToInt32().ToString()); m_txtClass.Text = this.GetClassName(_hCurrentWindow); m_txtCaption.Text = User32.GetWindowText(_hCurrentWindow); if (m_txtClass.Text == "Edit" || m_txtCaption.Text == "") { m_txtCaption.Text = User32.GetText(_hCurrentWindow); } //end if User32.GetWindowRect(_hCurrentWindow, out User32.RECT rc); User32EnumChildWindows.EnumChildWindows(_hCurrentWindow, m_txtCaption.Text); // rect m_txtRect.Text = string.Format( "[{0} x {1}], ({2})", rc.Right - rc.Left, rc.Bottom - rc.Top, rc.ToString()); // highlight the window WindowHighlighter.Highlight(_hCurrentWindow); } //end else } //end try catch (Exception err) { Debug.WriteLine("HandleMouseMovements: " + err); FormClipboard.TraceLn(false, "FormSpyWindow", "HandleMouseMovements", "Error: {0}", err.Message); } //end catch } //end HandleMouseMovements