GetRandomRegion not working on Windows7

#1
Using the GetRandomRgn function in windows does not work on Windows 7. The forms borders stay visible.

The following code on XP clears the entire window including borders and enables you to draw on the entire window area.

The code on Windows 7 clears only the client area and enables you to draw on the client area only

IntPtr hrgn, hdc;
hrgn = CreateRectRgn(0, 0, 0, 0);
hdc = GetWindowDC(hWnd);
int res = GetRandomRgn(hdc, hrgn, 4); // the value of SYSRGN is 4.
ReleaseDC(hWnd, hdc);
SetWindowRgn(hWnd, hrgn, true);
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.