|
-
Mar 6th, 2002, 01:09 AM
#1
Thread Starter
Hyperactive Member
External ListView
How can I Count The Number Of Items In A ListView Out Side Of My Program? What's The API Call For It?
Also How Can I Click A ListView Item Or Double Click A Item.
-
Mar 7th, 2002, 05:54 AM
#2
Fanatic Member
You have to find the window handle of the listview first using findwindowEx - do a search on the forum for that code, theres loads of threads with it in.....
and to find the number of items in a listview....
Code:
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
Private Const LVM_FIRST = &H1000 '// ListView messages
Private Const LVM_GETITEMCOUNT = (LVM_FIRST + 4)
Private Sub cmdGetListItems_Click()
Dim lNumItems&
lNumItems = SendMessage(lvw1.hwnd, LVM_GETITEMCOUNT, 0, 0&)
MsgBox lNumItems & " Item(s) in listview"
End Sub
Private Sub Form_Load()
Dim i%
For i = 1 To 20
lvw1.ListItems.Add , , "HELLO" & i
Next i
End Sub
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Mar 7th, 2002, 05:58 AM
#3
Fanatic Member
to click an item you'll need to send a notification message in the form of a WM_NOTIFY, with an NM_CLICK or NM_DBLCLK message within the NMLISTVIEW Struct which is the lparam of the WM_NOTIFY message.....
I don't have any listview examples of this to hand though sorry....
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Mar 7th, 2002, 10:54 AM
#4
Thread Starter
Hyperactive Member
Well I figured out the count the # of items, thanks. Now on to the click event.
Yeah i know how to find the window and all that. 
Not totally sure what you were saying but i'll have to look up those constants and mess around with it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|