[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left; //最左坐标
public int Top; //最上坐标
public int Right; //最右坐标
public int Bottom; //最下坐标
}
//飞信示例:
RECT fx = new RECT();
GetWindowRect(h, ref fx);//h为窗口句柄
int width = fx.Right - fx.Left; //窗口的宽度
int height = fx.Bottom - fx.Top; //窗口的高度
int x = fx.Left;
int y = fx.Top;