Windows 7 GetRandomRegion not working on Windows7

Leo H

New Member
Joined
May 26, 2010
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);
 
Back
Top Bottom