I made ListBox and took handle to its device context i created compatible DC with this ListBoxDC and then tryied to BitBlt it onto the my main window DC (hdc). This ain't working. Can somebody explain to me what can i do with DCs and what i cant.:mad:
Posted on 2003-04-13 13:05:48 by AceEmbler
Post your code so we can see what your doing.
Posted on 2003-04-13 13:59:01 by IwasTitan
Or better yet, explain what you want to do rather than having us guess
Posted on 2003-04-13 14:39:22 by Sephiroth3
SIMPLY:

.date
backa db "c:\bitmapy\backgr.bmp",0


WinMain:
invoke LoadImage,hInst,addr backa,IMAGE_BITMAP,600,500,LR_LOADFROMFILE
mov hbackgr,eax
invoke CreatePatternBrush,eax
mov hbrush,eax

.IF uMsg==WM_CREATE
invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR ListClassName,0,WS_VISIBLE or WS_BORDER or WS_CHILD or \
LBS_HASSTRINGS or LBS_NOINTEGRALHEIGHT or LBS_SORT or LBS_OWNERDRAWFIXED,350,150,200,300,hWnd,ListID,hInstance,NULL
mov hListBox,eax

.ELSEIF uMsg==WM_CTLCOLORLISTBOX
mov ebx,wParam
mov hListBoxDC,ebx
invoke CreateCompatibleDC,hListBoxDC
mov hListBoxTempDC,eax
invoke SelectObject,hListBoxTempDC,hbrush
invoke SetBkMode,hListBoxDC,1
invoke SetTextColor,hListBoxDC,255
mov eax,hbrush
ret

.ELSEIF uMsg==WM_PAINT
invoke BeginPaint,hWnd,ADDR ps
mov hdc,eax
invoke BitBlt,hdc,100,100,100,100,hListBoxDC,0,0,SRCCOPY
invoke EndPaint,hWnd,ADDR ps
Posted on 2003-04-13 15:10:53 by AceEmbler
Try not loading a brush from a file and see if that works.

Just a suggestion.

Not sure if I'm helping.

I don't see anything wrong with your code except this seems kind of obscure.

from win32 hlp on LoadImage



If the hinst parameter is non-NULL and the fuLoad parameter does not include LR_LOADFROMFILE, lpszName is a pointer to a null-terminated string that contains the name of the image resource in the hinst module.

i.e. try a resource
Posted on 2003-04-13 21:47:57 by IwasTitan
AceEmbler,

Why don't you consider using a listview with the LVS_REPORT style, it is better suited to this type of thing because they are built into the control. It will also give you many more display options such as variable width columns and subitems.

You have messages such as LVM_SETBKIMAGE and LVM_SETBKCOLOR as well as LVM_SETTEXTCOLOR and LVM_SETTEXTBKCOLOR that control those exact things.
Posted on 2003-04-13 23:41:11 by donkey



Why don't you consider using a listview with the LVS_REPORT style, it is better suited to this type of thing because they are built into the control. It will also give you many more display options such as variable width columns and subitems.

You have messages such as LVM_SETBKIMAGE and LVM_SETBKCOLOR as well as LVM_SETTEXTCOLOR and LVM_SETTEXTBKCOLOR that control those exact things.



So what's the meaning of ListBox if ListView is better ?? Is there something i cant make with ListView and can with ListBox ???

Try not loading a brush from a file and see if that works.


I wont to load it from a file and it's not a point cuz brush is working correctly. Problem is with compatibility with Device Contexts

I just wont to take one DC and BitBlt it into another one. But this DCs are from different kind of Window one is our main window and another one is DC made from ListBox
Posted on 2003-04-14 03:18:57 by AceEmbler
You can't use the DC that is passed to WM_CTLCOLORLISTBOX, because it will only be set up like that when the listbox is processing the WM_PAINT message. Instead you should call GetDC to get a device context set up for the listbox, use it for whatever and then call ReleaseDC.
By the way, what are you going to do with the memory DC you create every time the listbox is drawn and which you never delete and which you don't use for anything?
Posted on 2003-04-14 04:47:42 by Sephiroth3

You can't use the DC that is passed to WM_CTLCOLORLISTBOX, because it will only be set up like that when the listbox is processing the WM_PAINT message. Instead you should call GetDC to get a device context set up for the listbox, use it for whatever and then call ReleaseDC.
By the way, what are you going to do with the memory DC you create every time the listbox is drawn and which you never delete and which you don't use for anything?



I wont to make ListBox with Bitmap background.So since background is bugging while scrolling ListBox i need to fill my buffered ListBoxDC with background and then fill it with objects i wont to show in my ListBox.And then BitBlt the whole prepared DC into ListBox.
Posted on 2003-04-14 06:25:37 by AceEmbler
Can u tell me if bitmap background in ListView is bugged just like this one in ListBox, after scrolling ??
Posted on 2003-04-15 14:17:13 by AceEmbler