to explain the header nearer:

i want to change the syscolors, so that only MY OWN app uses these colors - and the rest of the programs should keep their own colors. using SetSysColor changes everything and i don't know other routines. i alos don't know exactly how to ownerdraw everything (especially the window itselfs!)




i've edited the image in relation to the cr*cking related material... now it's just a black window!

Posted on 2002-08-09 13:31:06 by hartyl
Have a look at this thread (they color a listbox but it can help you on the way), there are aslo some links to other threads there:
http://www.asmcommunity.net/board/index.php?topic=6201&highlight=Color+Listbox
Posted on 2002-08-09 14:28:00 by scientica
WM_CTLCOLOR*
Posted on 2002-08-09 15:10:56 by comrade
Depending on exactly what you want to change there are a number of ways to handle this.

For the Non-Client Area (caption bar, frame) you'll probably wanna intercept WM_NCPAINT and call DrawCaption and/or DrawFrameControl or some custom procedure

For Menus, you can use SetMenuInfo to set the background brush and other things. Also, you can intercept WM_DRAWITEM and WM_MEASUREITEM and set the menu items to OWNERDRAWN

For controls there are the WM_CTLCOLORxxx message that'll let you change their appearance.

--Chorus
Posted on 2002-08-09 15:18:17 by chorus
Take a look at an proggie i wrote to test owner drawing
Posted on 2002-08-09 16:01:34 by ante
grml... with your WM_CTLCOLORxxx-message i can only give window a brush to draw my costom-colored background and text. have you seen the image above? there's everything changed - the borders, the backgrounds, even the close and minimize-buttons! THAT's what i want. seems that i have to owner-draw everything - how?
Posted on 2002-08-10 09:56:31 by hartyl
Maybe you could use superclassing for buttons etc.

btw. the minimize and close buttons are just bitmaps stored as resources and everything in the window is subclassed/superclassed.
Posted on 2002-08-10 10:00:30 by ante
Ernie has a tutorial on his web page for his Timer program. It's very good.


http://ourworld.compuserve.com/homepages/ernies_world/a.htm

--Chorus
Posted on 2002-08-10 11:36:39 by chorus
you tell me, on which way i could get to my finish - but you dont tell me HOW?!
i've never done superclassing and subclassing, so i don't know how it works!

@chours: have you exactly viewed your link? the program, you mentioned, shows how to use a bitmap as a background. it looks like there are normal buttons on the window, but they're on the bitmap and cant be used...
Posted on 2002-08-10 14:14:14 by hartyl
hartyl, did you download the executable and install it. Or did you just post this message? The buttons are perfectly usable. It's right in front of me. They even depress when you click the mouse buttons. Oooh nifty.

If you want to learn about superclassing and subclassing go to Iczelions page: http://win32asm.cjb.net and go to the tutorials section. The relevent information is clearly labelled.

Furthermore, you can look into the APIs and WM_xxx message I mentioned earlier.

Both Ernie's and Iczelion's tutorials are quite infomative. I don't know what else you want short of somebody programming the app for you.

--Chorus
Posted on 2002-08-10 14:54:28 by chorus
I've tried this:


.ELSEIF uMsg==WM_CTLCOLOREDIT || \
uMsg==WM_CTLCOLORSTATIC || \
uMsg==WM_CTLCOLORBTN
invoke SetBkMode,wParam,TRANSPARENT
;invoke CreatePatternBrush,hBmpRegion
;invoke GetStockObject,NULL_BRUSH

mov eax,hBackBrush
ret


for a dialog on WinXP. hBackBrush is the pattern brush I created for the hbrBackground
member of the window class of my dialog. (I've also tried the latter two)

It works for radio buttons and static controls but not for push buttons (they're still standard grey) and
my edit box is colored but text and background get smeared when scrolling.

Will I have to owner draw those controls ?

chorus:
SetMenuInfo is real cool :alright:

Regards,

goofee
Posted on 2002-08-10 17:25:45 by goofee
Have your program(s) save and set the syscolors.


BOOL WINAPI SetSysColors(
int cElements, // number of elements to change
CONST INT *lpaElements, // address of array of elements
CONST COLORREF *lpaRgbValues // address of array of RGB values
);

GetSysColors..........

Hope this helps you.
Posted on 2002-08-10 18:02:38 by Roy Cline
No, actually it doesn't. ;)

I'm trying to use Bitmap as background.
Posted on 2002-08-10 18:06:44 by goofee
goofee

I think you blit the bitmap to the DC.

Also, maybe you could dosplashscreen and hold that as
your background - of this I am not sure.

Hope this helps.
Posted on 2002-08-10 18:42:42 by Roy Cline
I've tried this:




invoke LoadBitmap,hInstance,751
mov hBmpRegion,eax
invoke CreatePatternBrush,eax
mov hBackBrush,eax
mov wc.hbrBackground,eax ;COLOR_BTNFACE+1

.
.
.

.ELSEIF uMsg==WM_CTLCOLOREDIT || \
uMsg==WM_CTLCOLORSTATIC || \
uMsg==WM_CTLCOLORBTN
invoke SetBkMode,wParam,TRANSPARENT
;invoke CreatePatternBrush,hBmpRegion
;invoke GetStockObject,NULL_BRUSH

mov eax,hBackBrush
ret



It works for radio buttons and static controls but not for push buttons (they're still standard grey) and
my edit box is colored but text and background get smeared when scrolling.



hBackBrush is the pattern brush I created for the hbrBackground
member of the window class of my dialog.


As you can see I am not blitting the bitmap myself.

My problem is somewhat similar to this one:
http://www.asmcommunity.net/board/index.php?topic=5043&highlight=WMCTLCOLOREDIT
except I'm not having problems with the input itself but with the scrolling in the listbox.

I'll attach the file and a .d85 file wich you can open from the File Menu to see what I mean. (There will be errors but that's ok.)



Accidently messed s.th. up before posting:

invoke SetBkMode,wParam,TRANSPARENT
invoke CreatePatternBrush,hBmpRegion
invoke GetStockObject,NULL_BRUSH
must be
invoke SetBkMode,wParam,TRANSPARENT
;invoke CreatePatternBrush,hBmpRegion
;invoke GetStockObject,NULL_BRUSH
Posted on 2002-08-10 19:27:02 by goofee
Listbox messed up after scrolling and buttons don't get colored at all :confused:
This is what it looks like:
Posted on 2002-08-10 19:47:24 by goofee
Ok, from what I finally found after searching the board for hours :o it look I will have to use owner drawn buttons.
Quite a few for edit contrls, too, but nothing useful for my edit problem.

Would be nice if somone had a look at it and suprises me when I get up - 6 a.m., bedtime - I'll see you tomorrow. :o
Posted on 2002-08-10 22:50:06 by goofee
Goofee,
the smearing is caused by a null background brush to the list box. Or if you're subclassing it you might be intercepting the WM_ERASEBKGND message... I didn't really look at your code yet, but I've seen this problem before and I'm sure it's one of those two.

If the list box is owner drawn, you must erase the background either by passing a non-null brush or by painting the list box items yourself and calling FillRect or similar.

As you've already discovered, buttons are nasty for changing the background. From what I know you must owner draw them to change the background.

And yes, SetMenuInfo is very cool (you wouldn't believe how long it took me to find that API...)

--Chorus
Posted on 2002-08-10 23:46:17 by chorus
Just downloaded the program and I see it's not a list box but an edit control. So never mind that bit about drawing the list box items ;)

It's the background brush that needs to be changed

--Chorus
Posted on 2002-08-10 23:50:34 by chorus
Morning, I just got out of bed.

Changed to what and why ?
It works for the other two single line edit controls ... :confused:
You can type only numbers but deleting and rewriting is fine...

I've also noticed that when the window is redrawn (like when you
move it out the screen) the listbox is redrawn correctly, too. confused: :confused:
(btw passing a null brush don't help).:
Posted on 2002-08-11 05:27:40 by goofee