I want to know how to make to transparent the static text background.
I have an image backgrounded dialog and the text background rectangle doesn't looks like good.

This code doesn't works for me:
WM_CTLCOLORSTATIC:

invoke SetTextColor, wParam, #RGB_COLOR#
invoke SetBkMode, wParam, TRANSPARENT
invoke GetStockObject, BLACK_BRUSH
ret
Posted on 2005-02-26 09:12:28 by Zord


;@echo off
;goto make
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat, stdcall
option casemap:none
title Dialog Colour
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\gdi32.inc

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\gdi32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
m2m MACRO M1, M2
push M2
pop M1
ENDM
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
CurDate TEXTEQU <">, @Date, <">
CurTime TEXTEQU <">, @Time, <">
CurFileName TEXTEQU <">, @FileCur, <">

clrBack equ 00000000h ; black
clrFore equ 00888888h ; white
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DlgProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
FreeRes PROTO
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.const
szAppTitle db "Dialog Colour", 0
szMsgAbout db "Dialog Colour", 13, 10
db "Built on ", CurDate, " ", CurTime, 13, 10
db "Version 1.0", 13, 10
db "Coded by comrade <comrade2k@hotmail.com>", 13, 10
db "Web: http://www.comrade64.com/", 13, 10
db "http://comrade.ownz.com/", 13, 10
db "http://comrade.win32asm.com/", 13, 10
db "http://comrade64.cjb.net/", 13, 10
db "IRC: #asm, #coders, #win32asm on EFnet", 0
szMenuAbout db "&About Dialog Colour...", 0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data?
hIcon dd ?
hBrushBack dd ?
szUsername db 256 dup (?)
mbp MSGBOXPARAMS <>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
start: invoke GetModuleHandle, 0
mov [mbp.hInstance], eax
invoke DialogBoxParam, eax, 100, 0, ADDR DlgProc, eax
invoke ExitProcess, eax
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DlgProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
.if [uMsg]==WM_INITDIALOG
mov eax, [hWnd]
mov [mbp.hwndOwner], eax
invoke GetSystemMenu, eax, 0
push OFFSET szMenuAbout
push 10
push MFT_STRING
push eax
invoke AppendMenu, eax, MFT_SEPARATOR, 0, 0
call AppendMenu
invoke LoadIcon, [lParam], 2
mov [hIcon], eax
invoke SendMessage, [hWnd], WM_SETICON, 1, eax
invoke CreateSolidBrush, [hBrushBack]
mov [hBrushBack], eax
.elseif [uMsg]==WM_SYSCOMMAND
cmp [wParam], 10
je @@msga
.elseif [uMsg]==WM_COMMAND
mov eax, [wParam]
.if ax==104
invoke GetDlgItemText, [hWnd], 102, ADDR szUsername, sizeof szUsername
invoke MessageBox, [hWnd], ADDR szUsername, ADDR szAppTitle, MB_OK OR MB_ICONASTERISK OR MB_APPLMODAL
.elseif ax==105
@@msga: mov [mbp.cbSize], sizeof mbp
mov [mbp.lpszText], OFFSET szMsgAbout
mov [mbp.lpszCaption], OFFSET szAppTitle
mov [mbp.dwStyle], MB_OK OR MB_APPLMODAL OR MB_USERICON
mov [mbp.lpszIcon], 2
invoke MessageBoxIndirect, ADDR mbp
.elseif ax==106
invoke PostMessage, [hWnd], WM_CLOSE, 0, 0
.endif
.elseif [uMsg]==WM_CTLCOLORDLG || [uMsg]==WM_CTLCOLORBTN || [uMsg]==WM_CTLCOLOREDIT || [uMsg]==WM_CTLCOLORSTATIC
invoke SetTextColor, [wParam], clrFore
invoke SetBkColor, [wParam], clrBack
invoke SetBkMode, [wParam], OPAQUE
mov eax, [hBrushBack]
ret
.elseif [uMsg]==WM_CLOSE
invoke EndDialog, [hWnd], 0
invoke MessageBoxIndirect, ADDR mbp
;invoke MessageBox, NULL, addr CurTime, addr CurDate, MB_OK
call FreeRes
.endif
@@quit: xor eax, eax
ret
DlgProc endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
FreeRes proc
invoke DestroyIcon, [hIcon]
invoke DeleteObject, [hBrushBack]
ret
FreeRes endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start

:make
set name=dlgcolor1

\masm32\bin\ml /c /coff %name%.bat
\masm32\bin\rc %name%.rc
\masm32\bin\Link /subsystem:windows /merge:.text=.code %name%.obj %name%.res
del *.obj
del *.bak
del *.res
echo.
Posted on 2005-02-26 09:53:17 by dcskm4200
I founded the answer. If i return GetStockObject, NULL_BRUSH it's works correctly.
Posted on 2005-02-27 14:10:24 by Zord