Thanks to the comment from @TLama, I was able to solve this as follows:
Region := CreateRectRgn (0, 0, ClientWidth, ClientHeight);
ExcludedRegion := CreateRoundRectRgn (1, 1, ClientWidth - 1, ClientHeight - 1, 3, 3);
CombineRgn (Region, Region, ExcludedRegion, RGN_XOR);
SelectClipRgn (Canvas.Handle, Region);
Previously, the problem was that the area that passed as the first parameter CombineRgnwas not created. In one of the sentences of the related tutorial, a hint is given:
One more thing to indicate that the destination region in CombineRgn may be one of the source areas.
along with this information from MSDN:
hrgnDest [in]: handle to the new area with dimensions determined by the union of the two other regions. (This area must exist before calling CombineRgn.)
source
share