When i insert some items to ListView (REPORT) how can i refers them to some datas (structure in my place). I cant make it by refering to name cuz i have got items with the same label.
Posted on 2003-05-28 07:19:50 by AceEmbler
First you have to have a memory pointer then you and move that pointer to the lparam.. this is how I do it:

MRUInfo is my structure

push sizeof MRUInfo
push hHeap
call HeapAlloc ; Buffer for current LVITEM.lParam
mov ebx, eax

then you fill your structure/manipulate it... then you the listview item and the handle to you memory:

mov lvi.imask, LVIF_TEXT or LVIF_PARAM
mov lvi.iItem, ecx
mov lvi.iSubItem, 0
lea eax, [ebx].MRUInfo.DisplayName
mov lvi.pszText, eax

mov lvi.lParam, ebx

and that is it... sorry not commented, just copyed it over... when you are done with your listview, remember to loop through each listview item and free the memory..

unsure about anything, just ask!
Posted on 2003-05-28 09:33:36 by Gunner
But what heapens when somebody chose item in listView. Since it's refered by name. As i said befor i can have the same item labels
Posted on 2003-05-28 15:35:38 by AceEmbler
Use the index to identify the items in your listview or put a unique identifier in the lparam. I have never used the label to identify an item in the listview as you want this to be kept dynamic so you never know what's in it. When a user selects an item the listview will return the item index anyway and not the actual text in the item.
Posted on 2003-05-28 15:45:56 by donkey
Ofcourse lParam. I didn't notice it cuz i have printed Iczelions tutorial and this page was truncated in the bottom (to many excuses on my side but belive me it's true). Btw when i sort my list in a different way iItem will change or not ??? (Iczelion wrote that iItem is something as row so i'm thinking that sorting will affect iItem)
Posted on 2003-05-28 16:06:27 by AceEmbler
Just keep the unique ID in the lParam, it will follow the item when you sort, in the same way as it works for listbox controls.
Posted on 2003-05-28 16:15:00 by donkey