///
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetWindowRect(HandleRef hWnd, out RECT lpRect);
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
public int getWidth(RECT input)
{
return input.Right - input.Left;
}
public int getHeight(RECT input)
{
return input.Bottom - input.Top;
}
///
Используем так:
Код:
RECT r = new RECT();
Process p = Process.GetProcessesByName("NAME")[0];
GetWindowRect(new HandleRef(this,p.MainWindowHandle), out r);
MessageBox.Show(String.Format("Ширина(X):{0}\nВысота(Y):{1}", getWidth(r), getHeight(r)));
________________
We are Ducks. We are birds. We like bread. We cryack. Cryack.