GetWindowRect on Windows 7 appears to not include the right and bottom window frame edges (at least with the Aero theme ), if the window was created without the WS_SIZEBOX(or another name WS_THICKFRAME) style.
The problem is on Aero, windows have the thickframe whether they can be resized or not. But the GetWindowRect function thinks that a non-resizeable window is thinner. Fortunately, there is another way to get window size and position by using DwmGetWindowAttribute() (After vista)
[DllImport(@"dwmapi.dll")]
private static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out Rect pvAttribute, int cbAttribute);
public static bool GetWindowActualRect(IntPtr handle, out Rect rect)
{
const int DWMWA_EXTENDED_FRAME_BOUNDS = 9;
int result = DwmGetWindowAttribute(handle, DWMWA_EXTENDED_FRAME_BOUNDS, out rect, Marshal.SizeOf(typeof(Rect)));
return result >= 0;
}
Source: http://www.code4copy.com/csharp/post/getting-window-rect-using-handle-on-windows-8-and-other