The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: dev_zero on February 16, 2005, 12:03:39 AM

Title: Different window layout/look
Post by: dev_zero on February 16, 2005, 12:03:39 AM
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?
Title: Re: Different window layout/look
Post by: Mark Jones on February 16, 2005, 04:56:58 AM
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.
Title: Re: Different window layout/look
Post by: dev_zero on February 16, 2005, 02:04:47 PM
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]
Title: Re: Different window layout/look
Post by: Relvinian on February 16, 2005, 03:23:19 PM
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
Title: Re: Different window layout/look
Post by: dev_zero on February 16, 2005, 04:06:46 PM
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.
Title: Re: Different window layout/look
Post by: jimh on February 16, 2005, 05:12:46 PM
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.
Title: Re: Different window layout/look
Post by: 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?
Title: Re: Different window layout/look
Post by: Relvinian on February 16, 2005, 11:33:17 PM
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
Title: Re: Different window layout/look
Post by: dev_zero on February 16, 2005, 11:52:37 PM
Thanks, it looks a little advanced, but I will take a look at it..
Title: Re: Different window layout/look
Post by: zooba on February 19, 2005, 09:53:56 AM
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.
Title: Re: Different window layout/look
Post by: pbrennick on February 19, 2005, 06:49:31 PM
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]
Title: Re: Different window layout/look
Post by: Ash_ on February 20, 2005, 11:35:39 AM
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  :(
Title: Re: Different window layout/look
Post by: pbrennick on February 20, 2005, 01:27:13 PM
Hi Ash,

You can get it at http://www.madwizard.org/dl.php?file=PNGlib

Paul
Title: Re: Different window layout/look
Post by: Ash_ on February 20, 2005, 02:42:48 PM
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.
Title: Re: Different window layout/look
Post by: pbrennick on February 20, 2005, 03:37:05 PM
Ash,
I'm glad you got it.  My link must have expired.  Look around that site, good stuff!

Paul
Title: Re: Different window layout/look
Post by: Avalon on February 21, 2005, 05:11:47 PM
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
Title: Re: Different window layout/look
Post by: dev_zero on February 21, 2005, 07:30:52 PM
pbrennick,
Thanks for the examples. It looked a little advanced at first view, but I'll take a closer look at it sometime.
Title: Re: Different window layout/look
Post by: pbrennick on February 21, 2005, 07:55:19 PM
dev_zero,
You see, now you have room to grow.  :green

Paul