public static WindowPlacement GetWindowPlacement(IntPtr windowHandle)
{
// Check if the handle is valid
HandleManipulator.ValidateAsArgument(windowHandle, "windowHandle");
// Allocate a WindowPlacement structure
WindowPlacement placement;
placement.Length = Marshal.SizeOf(typeof(WindowPlacement));
// Get the window placement
if (!NativeMethods.GetWindowPlacement(windowHandle, out placement))
throw new Win32Exception("Couldn't get the window placement.");
return placement;
}