News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

color of button

Started by Sturgeon, December 07, 2006, 12:13:37 PM

Previous topic - Next topic

Sturgeon

 Hi to all! I am the newbie in the assembler and I have a question. I tried to create the green button with the black text in a modal window. How can I do it? I studied "XXControls" and Iczelion`s "Buttons". But it is too much of information in there, and it is very difficult for understanding. I have attached my attempts.
Sorry for my poor English. I am Russian.

[attachment deleted by admin]

Tedd

Quote
BS_OWNERDRAW   Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created and a WM_DRAWITEM message when a visual aspect of the button has changed. Do not combine the BS_OWNERDRAW style with any other button styles.

When using BS_OWNERDRAW style, do not use an other BS_ styles.

green = RGB 0,255,0
black = RGB 0,0,0

You also need to handle the WM_DRAWITEM message - so you can draw the button text.
(You should prbably be handling WM_MEASUREITEM too.)
No snowflake in an avalanche feels responsible.

Sturgeon

I am afraid, I don`t clearly understood as make it.
Please, could you correct my source for example?

ToutEnMasm

Hello,
Russian zip ?,could not be open !?
                        ToutEnMasm

Sturgeon

Not Russian. Internatoinal. May be you have old version? My Zip is 9.0.

trodon

Quote from: Sturgeon on December 07, 2006, 05:14:38 PM
Not Russian. Internatoinal. May be you have old version? My Zip is 9.0.

your is also old, there is new v11 ;)
and btw this can be also opened with winrar ;)

MichaelW

It appears to be just a standard zip file. Even the now 10-year old PKZIP 2.50 works OK.

eschew obfuscation

Sturgeon

This is very good zip. Help me, please.

ToutEnMasm

Hello,
creating the button

invoke CreateWindowEx,0,SADR("BUTTON"),SADR("ok"),WS_CHILD or BS_OWNERDRAW or WS_VISIBLE ,200,200,50,50,hwnd,NULL,hInstance,NULL
mov Hbouton,eax ;se retrouve dans le lparam de

invoke CreateSolidBrush,008000FFh
mov HbutBrush,eax





Making a colored button


.ELSEIF uMsg == WM_CTLCOLORBTN
mov eax,Hbouton
.if eax == lParam             ;lParam = handle of button,wParam = HDC
mov eax,HbutBrush
ret
.endif




ToutEnMasm



ToutEnMasm

Hello,
It is written by E.Wayne.
He have made many good sources.His work is something valuable.He have stopped to update His site (too bad)

http://asmedit.massmind.org/
                            ToutEnMasm

trodon

Quote from: ToutEnMasm on December 08, 2006, 01:44:32 PM
Hello,
It is written by E.Wayne.
He have made many good sources.His work is something valuable.He have stopped to update His site (too bad)

http://asmedit.massmind.org/
                            ToutEnMasm


many thanks for links  :U

Sturgeon

ToutEnMasm
ToutEnMasm, thanks a lot to you and E.Wayne! This program is very useful for training. But my example with WM_CTLCOLORBTN  does not work still. It output simply red rectangle :(

[attachment deleted by admin]

Darrel

I read somewhere long ago to use WM_CTLCOLORSTATIC instead of WM_CTLCOLORBTN. So your code would be something like:

cmp uMsg,WM_CTLCOLORSTATIC
jne somethingelse00000

mov eax,lParam
cmp eax,hwndbutton
jne somethingelse00001

INVOKE SetTextColor,wParam,dwDesiredColor00
INVOKE SetBkColor,wParam,dwDesiredColor01
mov eax,hBrush
ret


Regards,

Darrel