News:

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

Listview with XP Style, Problem

Started by morlok, February 26, 2006, 08:37:29 PM

Previous topic - Next topic

morlok

When I try a listview with a bitmap on the background it work correctly on non XP style, but when i put the 'style.manifest.xml', the first item is black (text and background).

why?

This is my code. (in the attachment are the test program)

DialogProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL hdc:HDC, rect:RECT

mov eax,uMsg
.if eax==WM_INITDIALOG
invoke InitDialog, hWnd
.ELSEIF uMsg == WM_ERASEBKGND
m2m hdc,wParam
invoke GetClientRect, hWnd,ADDR rect
invoke FillRect, hdc,ADDR rect, hBkGrnd   
ret
.elseif eax==WM_CLOSE
invoke EndDialog,hWnd,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret

DialogProc endp
;================================================================================
InitDialog Proc uses esi edi ebx hWnd:HWND
LOCAL lvc:LV_COLUMN, Cont:DWORD
LOCAL Item:LV_ITEM, Cont2:dword
LOCAL bit:BITMAP

invoke GetDlgItem, hWnd, IDC_LSV1
mov hwnd_ListView, eax

invoke SendDlgItemMessage,hWnd, IDC_LSV1,LVM_SETEXTENDEDLISTVIEWSTYLE,\
LVS_EX_GRIDLINES + LVS_EX_FULLROWSELECT,\
LVS_EX_GRIDLINES + LVS_EX_FULLROWSELECT


invoke SendDlgItemMessage,hWnd, IDC_LSV1,LVM_SETBKCOLOR,0,CLR_NONE
                invoke SendDlgItemMessage,hWnd, IDC_LSV1,LVM_SETTEXTBKCOLOR,0,CLR_NONE


mov Item.imask,  LVIF_TEXT
mov Item.cchTextMax,256

mov lvc.fmt, LVCFMT_RIGHT
mov lvc.imask, LVCF_TEXT or LVCF_WIDTH OR LVCF_FMT
                mov lvc.lx, 100

lea ebx, szText
mov lvc.pszText, ebx
mov Cont, 0
.while Cont < 4
INVOKE SendDlgItemMessage,hWnd, IDC_LSV1, LVM_INSERTCOLUMN, Cont, addr lvc
inc Cont
.endw

mov Cont, 0
lea eax, szText
mov Item.pszText,eax
.while Cont < 20
m2m Item.iItem, Cont
mov Cont2, 0
m2m Item.iSubItem, Cont2

invoke SendDlgItemMessage,hWnd, IDC_LSV1, LVM_INSERTITEM, NULL, ADDR Item

.while Cont2 < 4
inc Cont2
m2m Item.iSubItem, Cont2
invoke SendDlgItemMessage,hWnd, IDC_LSV1, LVM_SETITEM, NULL, ADDR Item
.endw

inc Cont
.endw



;--------------------------------------------------------------------------------
;Create a Brush from Resource
invoke LoadBitmap,hInstance, 251
mov hBitmap1,eax

invoke CreatePatternBrush,hBitmap1
mov [hBkGrnd],eax

;--------------------------------------------------------------------------------
ret
InitDialog endp



The Rc file:
251  BITMAP   DISCARDABLE "res/background.bmp"

1 24 "style.manifest.xml"

Thanks.

[attachment deleted by admin]