【发布时间】:2011-06-20 17:43:31
【问题描述】:
我正在尝试获取当前活动窗口的高度和宽度。
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
private static extern bool GetWindowRect(IntPtr hWnd, Rectangle rect);
Rectangle bonds = new Rectangle();
GetWindowRect(handle, bonds);
Bitmap bmp = new Bitmap(bonds.Width, bonds.Height);
此代码不起作用,因为我需要使用RECT,但我不知道如何使用。
【问题讨论】: