Source

SharpHammer / DarkMotion / DHView.cs

Full commit
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace DarkMotion
{
	public partial class DHView : UserControl
	{
		public DHView()
		{
			InitializeComponent();
		}

		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);
		}

		protected override void OnPaint(PaintEventArgs e) { }

		protected override void OnPaintBackground(PaintEventArgs e)	{ }

		static bool AppStillIdle
		{
			get
			{
				Message msg;
				return !PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
			}
		}

		[System.Security.SuppressUnmanagedCodeSecurity]
		[DllImport("user32.dll", CharSet = CharSet.Auto)]
		[return: MarshalAs(UnmanagedType.Bool)]
		private static extern bool PeekMessage(out Message msg, IntPtr hWnd,
			uint messageFilterMin, uint messageFilterMax, uint flags);

		[StructLayout(LayoutKind.Sequential)]
		struct Message
		{
			public IntPtr hWnd;
			public uint msg;
			public IntPtr wParam;
			public IntPtr lParam;
			public uint time;
			public System.Drawing.Point p;
		}
	}
}