Windowed but not....

Started by
2 comments, last by atn2002 22 years, 10 months ago
This may be an easy subject, but...: Windows media player does it, Real JukeBox too. Skin mode, ya know, without a title bar and more than just a 4 sided Window (any shape really). What kinda window mode is that and how do I create one with Visual C++ 6.
Advertisement
I am pretty sure the code is the same as a regular window. The program is just drawing ALL the parts itself instead of offloading to the OS - and it looks for clicks more activley and anything that does not map to the bitmap of its funky window gets handed right back to the OS.

Not sure if thats it - just how I see to do it.

Landsknecht
My sig used to be, "God was my co-pilot but we crashed in the mountains and I had to eat him..."
But folks whinned and I had to change it.
To get a non-rectangluar shaped window, use the function SetWindowRgn() under Win 95, 98, ME and NT <= 4.0. In Windows 2000, there''s a new (faster) way, and that''s to use Layered Windows (See SetLayeredWindowAttributes())

To use SetWindowRgn() you first need to define a HRGN - a handle to a region. This is quite simple to do: use one of CreatePolygonRgn(), CreateEllipticalRgn(), CreateRectRgn() etc (there''s a few of them) If your shape is very irregular, you can use a series of CreateRectRgn() and combine them with CombineRgn(). One way is to take a bitmap, and for each pixel of your window, do a CreateRectRgn() with a rect that is 1x1 pixel, and CombineRgn() it with the other pixels. It''s quite slow, but you usually only do it at application startup anyway.

SetLayeredWindowAttributes() is a bit simpler to use (but only supported on Win2k and XP) You just give it a colour that you want to be the transparent colour, and that''s about it You can also do semi-transparent windows with this one.

War Worlds - A 3D Real-Time Strategy game in development.
To create a window without title-bar, borders, etc. Just specify WS_POPUP as the style when creating the window (and '|' it with other styles you want, but not WS_OVERLAPPED, WS_OVERLAPPEDWINDOW or similar)

If you have Visual C++ there is a tool included called Spy++ (spyxx.exe) that you can use to look at different properties of a window in a running program (such as seeing what window-styles were specified for that window etc).

Edited by - Dactylos on June 10, 2001 4:55:50 AM

This topic is closed to new replies.

Advertisement