调用 GetClientRect winAPI [英] Call GetClientRect winAPI
本文介绍了调用 GetClientRect winAPI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在尝试调用 GetClientRect 并传入 Stuct 以填充返回值时遇到问题.这是我的代码.
I am having an issues trying to call the GetClientRect and passing in a Stuct to get populated with the values that are returned. Here is the code I have.
[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 嵌入式语句不能是声明或标记语句.
I keep getting the error on the RECT saysing Error 1 Embedded statement cannot be a declaration or labeled statement.
我只需要帮助从 GetClientRect 中取回左上右下值
I just need help getting back the left top right bottome values from the GetClientRect
推荐答案
我发现我把代码放在 if 之后,忘记添加 { } 所以我现在很好.
I found it I put the code after an if and forgot to add { } so I am good now.
这篇关于调用 GetClientRect winAPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文