I have seen programs with for example, transparent messageboxes and windows, with completely different borders and different buttons and so on. How can I make windows like that, which doesn't have the "standard" window look. Is this very advanced?
Hello. I've seen a few ways to create custom windows. The most common method is probably to make a "resource file" with your window parameters in it. Several other HLL compilers will make Resource.RC files, and you can even find stand-alone applications to make them like Borland's Resource Compiler. Most of the parameters in the resource file can be coded directly in the app also but this is less common. Another method, probably the easiest, is to use an IDE like Easy Code to manage your window parameters. Hope that helps.
I was thinking of making a window which looks something like this attachment. I don't now how to explain this better so have a look. Do you know of any tutorial sites which have any tutorials on this subject?
[attachment deleted by admin]
I don't know of any tutorials on how to draw transparently. There are a lot of examples out there but most is in C/C++, C# or VB.NET. The later OSes also have a TransparentBlt API call you can use to draw transparently.
Along with those, you can create a Region of your area you want drawn too.
I'll check around and see if I can find some ASM examples for ya.
Relvinian
I have looked around in the windows api and the thing I think I have to do, is to make my own windows class or something and create a device context and use the GDI library to design my own window, edit: I have searched around and what I'm trying to do is to make a skin for my window..
I have never done this before, so if anyone could show me some example code about how I "design" my own windows that would be great.
By default all windows come as a rectangle and really, we're all creating our own window classes every time your app starts (see: RegisterClassEx) so there's nothing special there. The only time you need to create a window region is if you want a non-rectangular window; you can create windows with rounded borders. To do something similar to "skinning" your application so that it is transparent, has a non-standard non-client area, or custom menus you will have to handle the creation and painting messages such as WM_NCCREATE, WM_NCACTIVATE, WM_NCCALCSIZE and WM_NCPAINT. Be aware that your painting should be as efficient as possible because the code to do the painting could be called frequently.
For instance, WM_NCACTIVATE is called when the application gains/loses the input focus and in a Windows app you would see the titlebar and frame change color based on the current theme.
Also you'll have to handle the WM_NCMOUSEMOVE (and similar) messages to keep track of what is happening to any buttons you've drawn in your non-client area. As you can see, it can get complicated to create an applicatioin where Windows doesn't handle the window frame for you.
I don't know which functions to use or anything about skinning a window in general.
Does anyone know of any good code examples for skinning a window, C or Assembly doesn't matter?
Quote from: dev_zero on February 16, 2005, 11:25:47 PM
I don't know which functions to use or anything about skinning a window in general.
Does anyone know of any good code examples for skinning a window, C or Assembly doesn't matter?
There are a lot of examples on how to skin controls which can be used to model from -- most are in C/C++ and .NET source. Just google for them.
Here is one link to get you started:
http://www.codeproject.com/useritems/SkinCtrl.asp
Relvinian
Thanks, it looks a little advanced, but I will take a look at it..
Have a look at the 'SetLayeredWindowAttributes' API call on MSDN (just search for it). It's only for Windows 2000/XP, but it may achieve some of the effects you're looking for.
dev_zero,
While snooping, I found five neat examples you might like, two are attached to this post. All are courtesy of Qweerdy. One example shows some cool stuff, like a scrollbar and colorizing a skin at run time. The other is a Window with per-pixel alpha transparency. It uses Thomas' PngLib to load a 32 bit png with a alpha channel and sets this as a window's shape and background. To do this it uses the WinXp/2000 only API UpdateLayeredWindow.
The examples contain code by bitRAKE, Eoin, and Iblis' HSL conversion routines, Qweerdy is the one who put it all together AFAIK and asks that you make mention of him (only right) in the docs.
The other 3 can be posted as an attachment if you want to take a boo. I had to split them up because of file size constraints. The best two, IMO, are attached.
Paul
[attachment deleted by admin]
where can i get the pnglib include file and lib file, i really want to muck around with this, i tried googling but there all in languages i cant understand :(
Hi Ash,
You can get it at http://www.madwizard.org/dl.php?file=PNGlib
Paul
hey pbrennick, thanks very much.
if i go directly to that link i get a Forbidden error, so i just went to the main page and then the downloads page.
Thanks again.
Ash,
I'm glad you got it. My link must have expired. Look around that site, good stuff!
Paul
Hi all,
as usual Paul very nice example. :U
What i do not understand is the using of the different Fileformat of PNG
As i know the "standart" format of PNG is 24 (RGB by 8 bit per channel)
The used format is PNG 32 Alphachannel + RGB thats is clear.
example 4 Picturesize: 300 x300 32bit PNG (61KB)
How can I converte a "normal" PNG (24bit) or bitmap (here is possible to 32bit) maybe easyier to PNG 32?
Many thanks,
Avalon
pbrennick,
Thanks for the examples. It looked a little advanced at first view, but I'll take a closer look at it sometime.
dev_zero,
You see, now you have room to grow. :green
Paul