X

Round Windows or with Holes

With the SDK (Software Development Kit) for Windows, you can create windows with holes of various shapes, for example, might be useful to have a crack on the windows underneath or maybe just out of curiosity. The function that allows us all this is SetWindowRgn which combines a window, not just the DC (Device Context), an area of clipping.

int SetWindowRgn (HWND hWnd, HRGN hrgn, BOOL fredraw)

The first argument is the handle of the window to treat (hole), the second is the region to be cut and the third defines whether or not to redesign the window. The return value is 0 if all goes well or a positive value if it goes wrong. We define a function for the region of the clip (eg SetClipWindow) that creates a rectangular region that is the main window CreateRectRgnIndirect (&rcWindow), then create another shape of the region with such CreateEllipticRgnIndirect that will be the hole and finally subtract the two with CombineRgn (hrgTarget, hrgFinestra, hrgBuco, RGN_DIFF) and then at the end of our function is the call that we have explained before: SetWindowRgn (hwndFinestra, hrgTarget, TRUE).

Now just enter our function (eg SetClipWindow) obviously in WM_PAINT event and even before showing the main window when the program starts.

From this article you can get various ideas, including one to remove all or part of a window for example, whether a circle around and make it short, at this point there is no limit to the imagination.

Know all the parts even the most remote Windows SDK and you think that this feature was included with Windows 95, it is very important, but given its size, it is not easy, and then thanks to articles like this you can understand what can really do with the programming and the SDK (Software Development Kit).

giampy107:
X

Cookies Policy

We use cookies to personalize content and ads, provide social media features and analyze our traffic. We also share information about your use of our site with our web analytics, advertising and social media partners who may combine it with other information you have provided to them or that they have collected based on your use of theirs. services.

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings