News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

setting the Title bar color of a Window

Started by LordAdef, April 22, 2025, 05:04:00 AM

Previous topic - Next topic

LordAdef

Hi fellow Masmers!

I have no idea, but I reckon this is the place to ask this. Modertor, correct me if I'm wrong

I need to change the color of my Title bar window, or.. make my window dark style.

I don't know if Microsoft makes things like this just to torture us, but it shouldn't be that hidden.

Anyway, any help would be very appreciated!
Alex

fearless

Indirectly this is related to the topic: https://www.catch22.net/tuts/win32/custom-titlebar/

You can handle the Non Client area of a window, just like in the tutorial linked above, and override it to paint it in WM_NCPAINT event. But there might be a lot more to do there, been a while so cant recall if just painting a color rectangle in WM_NCPAINT would suffice, or if there is more to consider.

Might be other ways involving using DWM to extend the client area into the Non Client area and handle the top part yourself to make a fake titlebar.

A third option is similar to the ModernUI_CaptionBar, where you create a control that emulates the titlebar and handles the drawing within itself and any buttons etc: https://github.com/mrfearless/ModernUI/tree/master/Controls/ModernUI_CaptionBar

zedd151

Just for clarification LordAdef, what OS are you running?
System wide, or for one particular program that you are writing?

LordAdef

Quote from: fearless on April 22, 2025, 05:31:08 AMIndirectly this is related to the topic: https://www.catch22.net/tuts/win32/custom-titlebar/

... override it to paint it in WM_NCPAINT ...

A third option is similar to the ModernUI_CaptionBar, where you create a control that emulates the titlebar and handles the drawing within itself and any buttons etc: https://github.com/mrfearless/ModernUI/tree/master/Controls/ModernUI_CaptionBar
Hi Fearless,
I've tried the  WM_NCPAINT  thing, the result is horrible. It paints on top of the buttons...

I will check  ModernUI_CaptionBar, thanks for the tip

zedd151

Nothing really rings any bells for me.

There is however an example of creating a custom titlebar, etc. in the masm32 examples folder 'masm32\examples\exampl07\skins3', hutch style. It is also attached if you want to play with it.

LordAdef

Quote from: zedd151 on April 22, 2025, 05:57:44 AMJust for clarification LordAdef, what OS are you running?
System wide, or for one particular program that you are writing?
Hi Zedd,

I'm on win 11, but I need a inter OS solution.

OK, in the perfect world it wouldn't be such a hassle to have: invoke SetTitleBarColor, 0342466h
I am sure Microsoft wanted to torture us.... :dazzled:

LordAdef

Quote from: zedd151 on April 22, 2025, 06:07:24 AMNothing really rings any bells for me.

There is however an example of creating a custom titlebar, etc. in the masm32 examples folder 'masm32\examples\exampl07\skins3', hutch style. It is also attached if you want to play with it.
Nice! I will check this one

I mean... it doesn't look that nice by my taste, but it a start

zedd151

Quote from: LordAdef on April 22, 2025, 06:10:43 AMI mean... it doesn't look that nice by my taste, but it a start
I had used it a few times myself. But not in orange.  :tongue:

My digitial alarm clock using 'skins3' as a guide is attached. Sorry for lack of comments there.

Beware. Clicking Exit places an icon in the notification area on the task bar and does not close the program. To completely close the program, right click the icon in the notification area of the task bar.  :cool:

zedd151


LordAdef

Quote from: zedd151 on April 22, 2025, 06:16:26 AM
Quote from: LordAdef on April 22, 2025, 06:10:43 AMI mean... it doesn't look that nice by my taste, but it a start
I had used it a few times myself. But not in orange.  :tongue:

My digitial alarm clock using 'skins3' as a guide is attached. Sorry for lack of comments there.

Beware. Clicking Exit places an icon in the notification area on the task bar and does not close the program. To completely close the program, right click the icon in the notification area of the task bar.  :cool:

Very nice Zedd!!!
I really like it

zedd151

Quote from: LordAdef on April 22, 2025, 06:50:02 AMI really like it
Thanks.  :azn:  There may be (yet undiscovered) bugs in it. It was of my first 'big' projects. Well not really big, but kind of ambitous for a new coder (about ten years ago).

I got temporarily banned, and had that removed by hutch temporarily, originally.
I was a fresh, brand new member when I first posted it. Hutch thought I was just dumping my wares here.  :joking:  :rofl:

He did apologize for his knee jerk reaction afterward.