PDA

Click to See Complete Forum and Search --> : API's to poblate ListView control


nesta
Aug 31st, 2001, 03:20 AM
Hi, i want to speed up the process wich add items to a listview control.

If someone have some code about that ( i think using APIs is faster than the own methods of the control )

thank you in advance

mlewis
Aug 31st, 2001, 11:37 AM
I've been thru MSDN and the listview documentation. There are no APIs to add items; the listview control was designed for use with COM, so it doesn't support APIs.

nesta
Sep 1st, 2001, 10:43 AM
Are you sure ?

I know that using SendMessage with the parameter LVW_ADDITEM , and with special structure LVW_ITEM , we can poblat ethe listview.

BUT I WANT A LITTLE EXAMPLE PLEASE, BECAUSE I DONīT KNOW WHAT IīM DOING WRONG

bye

Nucleus
Sep 1st, 2001, 11:43 PM
Well I played around with this for 10mins and got this far. There is little to no info on the web that I could find for a VB implementation.

Well try this. If you get it to work properly, please send me an email thenucleus@start.com.au.


Option Explicit

Private Type LV_ITEM
mask As Long
iItem As Long
iSubItem As Long
state As Long
stateMask As Long
pszText As String
cchTextMax As Long
iImage As Long
lParam As Long
iIndent As Long
End Type

Private Declare Function SendMessage Lib "User32" _
Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long


Const LVIF_TEXT = &H1
Const LVM_FIRST = &H1000
Const LVM_INSERTITEMA = (LVM_FIRST + 7)



Private Sub Form_Load()
Dim LV As LV_ITEM

LV.mask = LVIF_TEXT
LV.iItem = 0
LV.pszText = "test"

Call SendMessage(ListView1.hWnd, LVM_INSERTITEMA, 0&, LV)

End Sub

Nucleus
Sep 1st, 2001, 11:44 PM
Sites that may help:
http://www.mvps.org/vbnet/index.html?code/comctl/lvitemindent.htm
http://www.mvps.org/vbnet/index.html?code/comctl/lvmembers.htm