Hi,
today, I coded a Virtual Listview for my Mailclient. It works great with a fantastic performance (adds 100.000.000 rows in 5 columns in under 100ms) but I've some problems when clicking the items.

If someone has experience with that topic, please share it! (programming language isn't important)

TIA,
bAZiK
Posted on 2001-10-01 12:24:01 by bazik
Oh, come on! Nobody created a Virtual Listview before?
Posted on 2001-10-01 16:36:54 by bazik
baZik,

a bit more infos would be helpful. If a virtual listview is a listview wiht type LVS_OWNERDATA, you just have to respond to message LVN_GETDISPINFO properly, thats all.

japheth
Posted on 2001-10-02 02:16:08 by japheth
japheth,
sorry here're some more informations:

Yes, it's a normal SysListView32with LVS_OWNERDATA style. Here's my (quite large) WM_NOTIFY routine from the main window. The problem is, that only every 5th item is added and the ListView crashes after some scrolling. But this only happens, if I add the contents from memory. If I use a variable (szTest db "Test", 0) it works fine.



.elseif uMsg == WM_NOTIFY

.if lFinish == 0

mov esi, lParam
assume esi:ptr NMHDR

.if ([esi].idFrom == ID_LISTVIEW && [esi].code == LVN_GETDISPINFO)

assume esi:ptr LV_DISPINFO

.if ([esi].item.imask & LVIF_TEXT)

mov ecx, pMem

lea ebx, szMailData1
@@:
mov al, byte ptr [ecx]
or al, al
jz @F
mov byte ptr [ebx], al
inc ebx
inc ecx
jmp @B
@@:
inc ecx
lea ebx, szMailData2
@@:
mov al, byte ptr [ecx]
or al, al
jz @F
mov byte ptr [ebx], al
inc ebx
inc ecx
jmp @B
@@:
inc ecx
lea ebx, szMailData3
@@:
mov al, byte ptr [ecx]
or al, al
jz @F
mov byte ptr [ebx], al
inc ebx
inc ecx
jmp @B
@@:
inc ecx
lea ebx, szMailData4
@@:
mov al, byte ptr [ecx]
or al, al
jz @F
mov byte ptr [ebx], al
inc ebx
inc ecx
jmp @B
@@:
inc ecx
lea ebx, szMailData5
@@:
mov al, byte ptr [ecx]
or al, al
jz @F
mov byte ptr [ebx], al
inc ebx
inc ecx
jmp @B
@@:
add ecx, 3
mov pMem, ecx

mov al, byte ptr [ecx]
or al, al
jz @F

.if [esi].item.iSubItem == 0
mov [esi].item.pszText, offset szMailData1

.elseif [esi].item.iSubItem == 1
mov [esi].item.pszText, offset szMailData2

.elseif [esi].item.iSubItem == 2
mov [esi].item.pszText, offset szMailData3

.elseif [esi].item.iSubItem == 3
mov [esi].item.pszText, offset szMailData4

.elseif [esi].item.iSubItem == 4
mov [esi].item.pszText, offset szMailData5

.endif
jmp @@skip

@@:
mov lFinish, 1
@@skip:

.endif

.endif

.endif


The memory block "pMem" contains a file wich looks like this:


#[COLOR=red]0[/COLOR]This is a Test![COLOR=red]0[/COLOR][email]bazik@x-mail.net[/email][COLOR=red]0[/COLOR]02.10.2001 11:05[COLOR=red]0[/COLOR]12345

0 = 00h

Every sentance is terminated by 0Ah, 0Dh and the file is terminated by 00h.
Posted on 2001-10-02 04:06:00 by bazik
bazik,

one reason why your program crashes may be that you don't include the iItem member in your "calculations". You will get a LVN_GETDISPINFO notification whenever windows needs to display a (sub)item. Your first task then should be calculating the right value of pMem by scanning your memory block (possibly counting the cr/lfs you find until they match the iItem member)

japheth
Posted on 2001-10-02 07:48:32 by japheth
i am getting semilat action ..
after xx items my virtual listview just goes blank and not items are shows untill it crashes when i close my app..
all text is stored in mem
any idea? :(
it could be that the size of the buffer are too small...hm.. increasing them works fine..
weird windows.. :D
Posted on 2003-08-20 09:51:54 by wizzra
There's an off-topic discussion on ideas for high performance virtual listviews (not much working code, though) at this thread...
Posted on 2003-08-20 16:15:36 by QvasiModo