flat assembler
Message board for the users of flat assembler.

Index > Windows > WM_STLCOLORxxx

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 24 Apr 2005, 08:06
How to use these messages? I tried to CreateBrushIndirect and then InvalidateRect the whole dialog while in WM_INITDIALOG.
Then in WM_CTLCOLORxxx I use SetBkMode and SetBkColor, and pass a handle to the brush (created by CreateBrushIndirect) to eax before return.

When initializing LOGBRUSH struct I use:
mov [lb.lbStyle], BS_SOLID
mov [lb.lbColor], 0000FF00h
push lb
call [CreateBrushIndirect]

What am I doing wrong?
Post 24 Apr 2005, 08:06
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 24 Apr 2005, 11:20
I've got it.
After passing a brush handle to eax I did jump to .retp: label, where

.retp:
mov eax, 1
return

so eax register with the brush handle was simply overwritten.
It's just a lack of attention
Post 24 Apr 2005, 11:20
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 25 Apr 2005, 10:41
my method:
1. create brush:

Code:
        invoke  GetSysColor,COLOR_BTNFACE
        invoke  CreateSolidBrush,eax
        or      eax,eax
        jz      @F
        mov     [hBackBrushLogo],eax
  @@:
    


2. in window proc catch WM_CTLCOLORxxx message:

Code:
        cmp     ax,WM_CTLCOLORSTATIC
        jz      .colordlg
    


3. at .colordlg i check some values and then paint:

Code:
        invoke  GetDlgItem,[hWnd],ID_STLOGO
        or      eax,eax
        jz      .not_processed

        cmp     [lParam],eax
        jnz     .not_processed

        cmp     [hBackBrushLogo],NULL
        jz      .not_processed

        invoke  SetBkMode,[wParam],TRANSPARENT
        invoke  GetSysColor,COLOR_BTNSHADOW
        invoke  SetTextColor,[wParam],eax
        mov     eax,[hBackBrushLogo]
        jmp     .finish
    
Post 25 Apr 2005, 10:41
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 25 Apr 2005, 10:42
4. don't forget to free brush object when WM_CLOSE is sent:

Code:
        cmp     [hBackBrushLogo],NULL
        jz      @F
        invoke  DeleteObject,[hBackBrushLogo]
  @@:

    
Post 25 Apr 2005, 10:42
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.