hi guys,
i started coding an mp3player in asm. the most important thing (besides the ability to play music) is the look. i also created my code for the window (looks fine, indeed) - BUT: if i have in my playlist (a listview control) a lot of songs, a scroll bar is displayed - a default color-scrollbar.
the listview gets the colors if i return a brush in eax on WM_CTLCOLOR...., but the WM_CTLCOLORSCROLLBAR does not work so. any possibilities?
Posted on 2002-11-11 14:45:32 by hartyl
If it is a window with WS_VSCROLL style and not a scrollbar control, the WM_CTLCOLORSCROLLBAR message won't work. Even if it is a scrollbar control, you will only be able to change the background color. You can use flat scrollbars, although I think that changing the thumb & button color is complicated even in flat scrollbars. Flat scrollbars cannot be used as common controls, so you have to build a window with the WS_VSCROLL style, and give to this window the dimensions of the scrollbar you want. The best way however, would be to build your own scrollbar from scratch. You can take ideas from James Brown's Cool Scrollbar library: (http://freespace.virgin.net/james.brown7/sourcecode.html)
Posted on 2002-11-11 15:45:50 by micmic
i had exactly the same problem... i tried everythingb but it isn't possible unless
you change the dll the scrollbar control resides in (like in this coolctrl project). the
only thing i got was hide the listview/box scrollbar via subclassing. then i added
a "real" scrollbar-CONTROL to it. the last step was directing the scrollbar msg's
to the new one (via subclassing, too). but even with a real scrollbar control you
can ONLY change the background color :(

a month ago i wanted to write my own listview... it worked great but i never
finished these darn scrollbars... maybe i implemend them sometime... it shouldn't
be such hard... however, you can find the test version here and a test
application here
Posted on 2002-11-12 04:11:40 by mob
hi all, i have a little bit related problem. i had made a flat button in C++, exactly in visual C with MFC. now, i want to made this in masm. and here i am, dont know how to this. i though theres no such thing like lpDrawItemStruct in masm, isnt it? how do i made same subclassing and re-used features in masm?
the src code and exe are at http://www.freewebz.com/daner/button.zip

Posted on 2002-11-12 04:40:51 by dion
lpDrawItemStruct IS defined somewhere... i think it's not in hutch's
windows.inc but you can look it up from c++ or from msdn. but it would
be way better to create your *own* button with gdi operations. it isn't
hard to do and you'll have full control over that thing... there should be
hundreds of examples somewhere on this board. just serch for it. oh
when i remember right then there's also a little example in the latest
masm package.
Posted on 2002-11-12 10:18:18 by mob
hi mob, i had search the board for "flat button" but dont find what i want. actually i know that i have to use SetWindowLong to set own winproc and trap WM_PAINT to do the painting .
but, i confused about how if theres lot of button? do these button can have common winproc? because in class, i just to have derived it and solved.
anyway, i dont see flat button sample in masm32 package.
eh, i just see ur button, hartyl. how do u do that?
Posted on 2002-11-12 20:14:14 by dion
i never worked with flat buttons but in my opinion you just have to set
a flag to make it apear flat. there are only a few ways to change the look
of a button. flags, customdrawn and ownerdraw. microsoft gives you
the possibility to draw a ready-made control on your self, this is called
"customdrawn". in this case windows gives you specific messages that
tell you what to do... if i remenber right it was WM_NOTIFY,
WM_MEASUREITEM and WM_DRAWITEM. if you respond to these msg's
you should be able to draw control specific things on your own... just
open up your api ref and look it up. msdn has also dozens of informations
on these messages. the 3rd way to draw a control would be to make it
fully on your own. i call this method ownerdrawn-control or custom-control
but i don't know if there's a better name for it. if you want to do listviews
and stuff it's hard work but a custom-button is easy to code. i think these
buttons in hartyls example *are* custom ones. in the i posted above
every control is made by me. please look in the latest masm package, there
you'll find 2 nice examples on how to do it. nan, a member of this board,
also wrote a wonderfull very easy to understand tutorial on how to code
custom controls. all you need is a little understanding on how to operate
with the windows gdi functions.
Posted on 2002-11-13 08:41:15 by mob
Maybe you can find some info from here: http://freespace.virgin.net/james.brown7/tuts/coolscroll.htm
Posted on 2002-11-13 10:46:10 by WinCC
have an mp3 player too :grin: , it plays all the stuff (fmod) but it looks like ****
For the Playlist I use LISTBOX-Control... but your playlist is cool :alright: how many time have you invested in it? was it hard? I started coding my player on 25.08.02 and Im still working, have some nice details like INI-File an so on, you can test it on:

Exe with DLL:

aktual EXE:

Can read Winamp 2.75 AND 2.7x playlists... can make them, you can add all files of a directory and so on...

Posted on 2002-11-13 11:11:49 by CDW
i have done the window some time before (coding a keygen 4 practice), but all the time sonique sucked more and more (it hangs all the time and sometimes my whole system - no i wont use WinAMP...), so i startet this mp3Player.
the code is pretty easy: i use DialogBoxParam for my windows (syle: flat, no border, no caption (no captiontext either)) and everytime my dialogproc is called, all params go through my DrawItem-func, which responses on:

WM_INITDIALOG (creating brushes, setting the captiontext)
WM_LBUTTONDOWN (for window-movement)
WM_PAINT (drawing the window)
all the WM_CTLCOLOR...-Messages (for the nice colors; if the return-value of DrawItem is !=NULL, the dialogbox returns it too (for brushes)
WM_DRAWITEM (every button has the OWNERDRAW-flag (0x0b), so the message is sent and the button drawn)

i might post my window-code too. it's even done for easy-colorchaning (color-constants)

i think i'll do my own ownerdrawn listbox (like moblist (if anyone knows it), but more steadable and with scrollbars)

btw: fmod is great!
Posted on 2002-11-13 12:25:47 by hartyl
thx mob and all. but i know those what u talk already. the problem is do i have to make 3 wndproc for 3 button for example to handle WM_DRAWITEM or can i just have a common shared with all 3 button? its related to class behaviour, so i dont know what if dont have class.

btw, is there any easy way to make resource script to be used with masm? the asmedit was too... impractical ;p

Posted on 2002-11-13 20:17:40 by dion
VC++6.0 ressource editor(the only good thing on it *g*)
Posted on 2002-11-14 10:37:15 by CDW
you dont need 3 wndprocs for your 3 buttons. i solved it like this:

DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
invoke DrawItem,hWin,uMsg,wParam,lParam
test eax,eax
jnz @f

[your normal dlg-proc goes here]
DlgProc endp

DrawItem proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
xor eax,eax
mov esi,lParam
assume esi:ptr DRAWITEMSTRUCT
mov eax,[esi].CtlType
m2m dc,[esi].hdc
.if eax==ODT_BUTTON
[draw the button]
xor eax,eax
mov eax,brush
.elseif uMsg==[and so on]
DrawItem endp

notice, that if the DrawItem-func returns a value != NULL, the DlgProc returns it too (for the brushes), else the DlgProc does the usual - some message might be handeled twice, but that's no problem.
Posted on 2002-11-14 13:23:08 by hartyl
thanks hartyl and all. i had finished the coding, but still lack some... optimizing and might be has a bug within.

when i implement what u said, hartyl, i just thinking for a while about how if i have...
say 100 buttons in my app, then how do i manage those all efficiently? there is a proprietary button flag that make i have to using old .if-.elseif switch to choose which flag should be changed.
u can see i use this switch case several times in my code. is there any way to simplify this?

Posted on 2002-11-15 20:23:42 by dion
I was also working on a MP3 player :grin:
Same problems as you (scrollbar) but the rest of the GUI looks nice. Part of the sources can be found here:
(it has buttons with mouse-over effect ;) )
Posted on 2002-11-16 05:31:30 by bazik
ha! the time of ugly scrollbar's over!

i coded a complete listview (almost like the moblist - thx mob!), with a header, multiselect, and the scrollbar. but it's only for my purposes. (it's a list for the mp3s, having a artist, songname and the time. everything written into a struct with a pointer to the next item --> a list). when the player is done, i'll post it. i found out, that its only compatible to Win98 (maybe Win95 too). i don't have Win2k, so i'll see if i find the bug...

i didn't know that so many guys want to write a mp3 player (i guess with fmod :) and meet here on the board - but thats nice!
Posted on 2002-11-16 07:10:59 by hartyl
Since im sure its long since gone, i will use this oportunity to offer the tut for distribution again ;)

If you have your listbox working, why not rip out the scroll bar routines into a separate custom control, for future projects that may not need a listbox....?

Anywho, for hartyl and anyone else interested, here is the Tutorial that Mob gave reference to earlier...

Posted on 2002-11-16 10:53:08 by NaN
If you guys are talking about flat scrollbars inside listviews maybe this can help:

LVM_FIRST equ 01000h ; This is defined in windows.inc

LVS_EX_FLATSB equ 0100h

... (Create your listview here).....;

Then insert this:



Posted on 2002-11-16 11:05:59 by hitchhikr
flat scrollbars would look good, but i can't use them, since the have still the syscolors and i can't cange em.

but i've finnaly implemented the great-looking scrollbar.
but i cant distribute it, since it works only in combination with the listview itsself. but the listview was also so implemeted, that it works only for my purpose (the header & the list items).
but here an image of the final version:
Posted on 2002-11-16 14:38:30 by hartyl
Hartyl, I only see the to of the image (only teh beginning of the scrollbar). Either the image (or window :rolleyes: ) is "broken", or something else is wrong.
Any way, the top of the app is looking nice. :)
Posted on 2002-11-16 15:07:39 by scientica