Results 1 to 5 of 5

Thread: API's to poblate ListView control

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    4

    API's to poblate ListView control

    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

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    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.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    4

    Thumbs down

    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

  4. #4
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    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 [email protected].

    VB Code:
    1. Option Explicit
    2.  
    3. Private Type LV_ITEM
    4.     mask As Long
    5.     iItem As Long
    6.     iSubItem As Long
    7.     state As Long
    8.     stateMask As Long
    9.     pszText As String
    10.     cchTextMax As Long
    11.     iImage As Long
    12.     lParam As Long
    13.     iIndent As Long
    14. End Type
    15.  
    16. Private Declare Function SendMessage Lib "User32" _
    17.    Alias "SendMessageA" _
    18.   (ByVal hWnd As Long, _
    19.    ByVal wMsg As Long, _
    20.    ByVal wParam As Long, _
    21.    lParam As Any) As Long
    22.        
    23.  
    24. Const LVIF_TEXT = &H1
    25. Const LVM_FIRST = &H1000
    26. Const LVM_INSERTITEMA = (LVM_FIRST + 7)
    27.  
    28.  
    29.  
    30. Private Sub Form_Load()
    31.     Dim LV As LV_ITEM
    32.    
    33.    LV.mask = LVIF_TEXT
    34.    LV.iItem = 0
    35.    LV.pszText = "test"
    36.    
    37.    Call SendMessage(ListView1.hWnd, LVM_INSERTITEMA, 0&, LV)
    38.    
    39. End Sub

  5. #5
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width