public static bool GetWindowRegion(IntPtr hWnd, out Region region) { IntPtr hRgn = NativeMethods.CreateRectRgn(0, 0, 0, 0); RegionType regionType = (RegionType)GetWindowRgn(hWnd, hRgn); region = Region.FromHrgn(hRgn); return(regionType != RegionType.ERROR && regionType != RegionType.NULLREGION); }