The MASM Forum

General => The Campus => Topic started by: ragdog on December 14, 2014, 07:45:51 AM

Title: Virtual Listview
Post by: ragdog on December 14, 2014, 07:45:51 AM
Hello Community

I want an example with a Virtual Listview

I set the style to LVS_OWNERDATA and lock this before fill the ListView

invoke LockWindowUpdate,hLV

;Fill listview items

invoke  SendMessage,ebx,LVM_GETITEMCOUNT,0,0
mov     lvi.iItem,eax
mov     lvi.imask,LVIF_TEXT
mov     lvi.iSubItem,0
m2m     lvi.pszText,pData
invoke  SendMessage,ebx,LVM_INSERTITEM,0,addr lvi


nvoke SendMessage,hLV,LVM_SETITEMCOUNT,nItems,LVSICF_NOINVALIDATEALL or LVSICF_NOSCROLL
invoke LockWindowUpdate,NULL


But After add items is this listView empty.

Have you an idea or a good example ?

regards,
Title: Re: Virtual Listview
Post by: Tedd on December 14, 2014, 12:31:43 PM
Are you handling the LVN_GETDISPINFO notifications?
Title: Re: Virtual Listview
Post by: ragdog on December 14, 2014, 10:01:31 PM
Hi

Must i handling LVN_GETDISPINFO?

Gives any good Tutorial about it or good example?
Title: Re: Virtual Listview
Post by: Tedd on December 15, 2014, 04:20:12 AM
Quote from: ragdog on December 14, 2014, 10:01:31 PM
Must i handling LVN_GETDISPINFO?
Yes, that is how it works.

The whole point is that the listview does not store any data for the items (because you already have it and don't want to waste memory duplicating it all) -- you only tell it how many there are (LVM_SETITEMCOUNT). Then, when the listview needs to display the data for specific items, it requests the information from you through LVN_GETDISPINFO -- so you fill in the LVITEM structure with the data for the item at the given index, and that is what it displays for that item.

Example attached 8)
Title: Re: Virtual Listview
Post by: ragdog on December 15, 2014, 07:02:41 AM
Thank you Tedd

is well explained and the source is well written to understand it.

I test it this days in my project.

Regards,