Hi, I wanna know how to "skin" a program (in masm32...) like WinAMP.
I have seen code, but I wanna a tutorial...
So you have one, or know where I can get one, please relpy!

Best Regards
// Christopher Vigren
Posted on 2001-11-09 08:27:12 by Christopher
I know of no tutorial. But i have many sources that might help.
Basically you have to take care of WM_PAINT and WM_NCPAINT messages.
It can get a little bit more complicated if apart from doing that, you have to code mouse logic. Which (afaik) is the case of winamp's and many others as well.



Latigo
Posted on 2001-11-09 13:56:09 by latigo
I had this source sitting around and it makes a nice base to learn from when you want to deal skinned windows.

As for mouse logic, here again is some old (very old) code I had which you may want to study and adapt to your own program, it should work as is inside a message loop.

Which sadly means it won't work first time in the attached source as it uses a msg loop based on optimisations suggested by The Svin.
BrdStruct Struct

Left dd ?
Right dd ?
Bottom dd ?
Top dd ?
RightMod dd ?
BottomMod dd ?
BrdStruct Ends

WNDStruct Struct
CaptionBar dd ?
Border BrdStruct {?}
rect RECT {?}
WNDStruct ends

.data
WND WNDStruct {20, {5, 5, 5, 5, ?, ?}, {?}}

.code
.ELSEIF uMsg == WM_LBUTTONDOWN
mov eax, lParam
mov edx, eax
and eax, 0FFFFh
and edx, 0FFFF0000h
shr edx, 16

.If eax < WND.Border.Left
.If edx < WND.Border.Top
invoke PostMessageA,hWnd,WM_NCLBUTTONDOWN,HTTOPLEFT,0
.ElseIf edx > WND.Border.BottomMod
invoke PostMessageA,hWnd,WM_NCLBUTTONDOWN,HTBOTTOMLEFT,0
.Else
invoke PostMessageA,hWnd,WM_NCLBUTTONDOWN,HTLEFT,0
.EndIf
.ElseIf eax > WND.Border.RightMod
.If edx < WND.Border.Top
invoke PostMessageA,hWnd,WM_NCLBUTTONDOWN,HTTOPRIGHT,0
.ElseIf edx > WND.Border.BottomMod
invoke PostMessageA,hWnd,WM_NCLBUTTONDOWN,HTBOTTOMRIGHT,0
.Else
invoke PostMessageA,hWnd,WM_NCLBUTTONDOWN,HTRIGHT,0
.EndIf
.ElseIf edx < WND.Border.Top
invoke PostMessageA,hWnd,WM_NCLBUTTONDOWN,HTTOP,0
.ElseIf edx > WND.Border.BottomMod
invoke PostMessageA,hWnd,WM_NCLBUTTONDOWN,HTBOTTOM,0
.ElseIf edx < WND.CaptionBar
invoke PostMessageA,hWnd,WM_NCLBUTTONDOWN,HTCAPTION,0
.Else
; Client Area
.EndIf

.ELSEIF uMsg == WM_MOUSEMOVE

mov eax, lParam
mov edx, eax
and eax, 0FFFFh
and edx, 0FFFF0000h
shr edx, 16

.If eax < WND.Border.Left
.If edx < WND.Border.Top
invoke LoadCursor, NULL, IDC_SIZENWSE
invoke SetCursor, eax
.ElseIf edx > WND.Border.BottomMod
invoke LoadCursor, NULL, IDC_SIZENESW
invoke SetCursor, eax
.Else
invoke LoadCursor, NULL, IDC_SIZEWE
invoke SetCursor, eax
.EndIf
.ElseIf eax > WND.Border.RightMod
.If edx < WND.Border.Top
invoke LoadCursor, NULL, IDC_SIZENESW
invoke SetCursor, eax
.ElseIf edx > WND.Border.BottomMod
invoke LoadCursor, NULL, IDC_SIZENWSE
invoke SetCursor, eax
.Else
invoke LoadCursor, NULL, IDC_SIZEWE
invoke SetCursor, eax
.EndIf
.ElseIf edx < WND.Border.Top
invoke LoadCursor, NULL, IDC_SIZENS
invoke SetCursor, eax
.ElseIf edx > WND.Border.BottomMod
invoke LoadCursor, NULL, IDC_SIZENS
invoke SetCursor, eax
.Else
invoke LoadCursor, NULL, IDC_ARROW
invoke SetCursor, eax
.EndIf
Posted on 2001-11-09 17:09:56 by Eóin
If I got your program right, E?in, the BMP is in the EXE... Or?
I wanna make a program that loades a external BMP.
Posted on 2001-11-10 04:55:03 by Christopher
Christopher,

Use the LoadImage API to load a file from disk.

Regards,

hutch@movsd.com
Posted on 2001-11-10 05:06:56 by hutch--
Is't just to change the LoadBitmap API to the LoadImage API?
Will the "redraw" code work then?
Posted on 2001-11-10 05:14:18 by Christopher
you can check my website (http://www.effervescence.com), there' s an example of a skinned window (keygen template =))

roy
Posted on 2001-11-10 05:28:40 by roy
Also Test Department has got some good examples on his web site (http://www.crahkob.com/td/). Give them a look.
Posted on 2001-11-10 06:28:17 by LuHa
Roy,

I check out your skinned window example a while ago... i liked the coding structure alot. And i think its an exellent example to "break away" from the beginner coding model that Hutch and Iczelion offers (Ewayne has some neat tricks to be learned from as well). I dont know if your example is the best source for skinned windows but i do think its a go00ooood source to be studied in general.

Just thought i would give your work some backing :)
Nice work..
:alright:
NaN
Posted on 2001-11-11 00:46:03 by NaN
hey ! thanks *alot* nan ! =)
i must say, i also respect your work,
i liked that object oriented project you' ve done, that' s also a really interesting way to program that *totally* breaks from the good old beginner way of coding =)
Posted on 2001-11-11 04:18:13 by roy
Thanx :)

Im glad you like our OOP model.. your right tho, it is a bit of a twist. Heh, its what kept it fun to work on :)

While its about 98% finished in design, there is still more to come as soon as Thomas and myself are outa school long enough to collaborate some more on it.. but in the mean time, im just trying to meat Hutch's deadline to get it out in the next Masm package.

Thanx again!
NaN
Posted on 2001-11-12 01:06:26 by NaN