我在尝试调用GetClientRect并传递一个Stuct来填充返回的值时遇到了问题。这是我的代码。
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll")]
internal static extern bool GetClientRect(IntPtr hwnd, ref RECT lpRect);
[StructLayout(LayoutKind.Sequential)]
internal struct RECT
{
internal int left;
internal int top;
internal int right;
internal int bottom;
}
RECT rect = new RECT();
GetClientRect(PApplication.Instance.MdiMain.Handle, ref rect);我一直收到关于RECT的错误,错误1嵌入式语句不能是声明或标记的语句。
我只需要帮助从GetClientRect取回左上角的bottome值
发布于 2012-10-26 20:34:14
我找到它了,我把代码放在if后面,忘了加{},所以我现在很好。
https://stackoverflow.com/questions/13086927
复制相似问题