The MASM Forum
General => The Campus => Topic started by: xandaz on June 07, 2012, 03:06:06 AM
-
Can someone tell me how it works for CD ListBoxes with LB_ADDSTRING? it send the WM_DRAWITEM the correct amount of times but itemData always has the same pointer. Look at the example. It made it work once but had reccour to memory allocations.
-
Hi xandaz,
you've never assigned something to the member itemData (cdlb.asm).
Try this in WM_DRAWITEM:
WndProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
LOCAL szBuffer[260]:WORD
[...]
.elseif uMsg==WM_DRAWITEM
mov edi,lParam
assume edi:PTR DRAWITEMSTRUCT
.if [edi].itemAction==ODA_DRAWENTIRE
invoke SetTextColor,[edi].hdc,0ffh
invoke SendMessage, [edi].hwndItem, LB_GETTEXT, [edi].itemID, addr szBuffer
invoke DrawText,[edi].hdc,addr szBuffer,-1,addr [edi].rcItem,DT_LEFT
.endif
[...]
.endif
xor eax,eax
ret
WndProc endp
Regards
Greenhorn
-
Thanks greenhorn.... it's just that i was presuming that by sending LB_ADDSTRING that itemData would point to it. Isn't it how it should work? Thanks
....Yeah....it works that way tho it need LBS_HASSTRINGS....thanks