Raw Win32 API, Strangely Shaped Windows, and Why They Mostly Disappeared
Key point
How to make elliptical, bitmap-based, and animated windows with Win32, and their limitations.
Details
Modern Windows desktop apps have settled mostly around web wrappers like React, Electron, and Tauri, which critics say have become bloated in terms of memory and performance. Back in the old Win32 days, by contrast, you could directly control the window itself to create more distinctive UI.
The core of it is the Win32 message loop. Within the flow of GetMessage → TranslateMessage → DispatchMessage, the app's behavior is built by handling messages like WM_CREATE, WM_PAINT, WM_SIZE, and WM_DESTROY.
On top of this structure, you can even create strangely shaped windows.
- Elliptical windows: Create a region with
CreateEllipticRgnand change the window's actual region withSetWindowRgn. - Drag handling: Without a title bar, you send
WM_NCLBUTTONDOWNwithHTCAPTIONinsideWM_LBUTTONDOWNto allow manual dragging. - Bitmap-based windows: Read a
shape.bmpand merge all pixels that are not the transparent color (e.g., RGB(255, 0, 255)) into a small region to form the window's shape. - Layered windows: Use
WS_EX_LAYEREDandUpdateLayeredWindowto overlay a 32-bit alpha image, drawing different pixels each frame so it behaves like an animated mascot.
This approach goes beyond simple circles or rectangles, making it possible to create windows like a dog running around as a mascot, or a toy-like window. The window is no longer a fixed rectangle, but becomes the pixels themselves at that moment.
However, the cost is clear. The moment you drop the frame, you become responsible for everything yourself: dragging, resizing, closing, hit testing, keyboard handling, DPI support, and redrawing. So while these windows are easy to make, polishing them properly is expensive.
Ultimately, this piece shows that Win32 still doesn't block this kind of expression. In most cases, a normal rectangular window is the right choice, but it's a reminder that the shape of the window itself can be used as a design element.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.