Example #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Peeks at the pending messages and if it finds any message in the given range, that
		/// message is removed from the stack and passed back to be handled immediately.
		/// </summary>
		/// <param name="min">The minumum message to handle.</param>
		/// <param name="max">The maximum message to handle.</param>
		/// <param name="msg">The message found, if any.</param>
		/// <returns><c>true</c> if a matching message is found; <c>false</c> otherwise.</returns>
		/// ------------------------------------------------------------------------------------
		private bool PeekMessage(Win32.WinMsgs min, Win32.WinMsgs max, out Win32.MSG msg)
		{
			msg = new Win32.MSG();
			return Win32.PeekMessage(ref msg, m_ownerControl.Handle, (uint)min, (uint)max,
				(uint)Win32.PeekFlags.PM_REMOVE);
		}
		/// <summary>
		/// Abort resetting if the user types anything, anywhere.
		/// Also sets the flag (if it returns true) to indicate the search WAS aborted.
		/// </summary>
		/// <returns></returns>
		private static bool ShouldAbort()
		{
#if !__MonoCS__
			var msg = new Win32.MSG();
			return Win32.PeekMessage(ref msg, IntPtr.Zero, (uint)Win32.WinMsgs.WM_KEYDOWN, (uint)Win32.WinMsgs.WM_KEYDOWN,
				(uint)Win32.PeekFlags.PM_NOREMOVE);
#else
			// ShouldAbort seems to be used for optimization purposes so returing false
			// just loses the optimization.
			return false;
#endif
		}