0
我有一個問題,試圖調用GetClientRect並傳遞一個Stuct以填充返回的值。這是我的代碼。致電GetClientRect winAPI
[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 saysing錯誤1嵌入語句不能聲明或標記語句錯誤。
我只是需要幫助從GetClientRect
你把這些行放在哪裏? – SLaks
當你說我又看了一遍,我忘了在if後覆蓋我的代碼{}。謝謝! – Spafa9