[DllImport("user32.dll")] private static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect); [StructLayout(LayoutKind.Sequential)] private struct RECT { public int left; public int top; public int right; public int bottom; } [StructLayout(LayoutKind.Sequential)] private struct SIZE { public int width; public int height; } private static SIZE GetWinSize(IntPtr _IntPtr) { IntPtr handle = _IntPtr; //取得したいWindowのハンドル RECT rect; bool flag = GetWindowRect(handle, out rect); SIZE size; size.width = rect.right - rect.left; size.height = rect.bottom - rect.top; return size; }

最新情報をチェックしよう!