VB and VBA Users Source Code: Returning the count of the selected items in a listview
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Returning the count of the selected items in a listview
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Thursday, November 29, 2001
Hits:
759
Category:
Windows API
Article:
The following code returns a count of the selected items in a listview: Option Explicit 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 'Purpose : Returns a count of the selected items in a listview. 'Inputs : lhwndListview The handle to the listview (eg. Listview1.Hwnd) 'Outputs : Returns a count on the number of selected items. 'Author : Andrew Baker 'Date : 23/07/2000 18:52 'Notes : Works on all versions of the listview 'Revisions : Function LVCountSelected(lhwndListview As Long) As Long Const LVM_FIRST = &H1000, LVM_GETSELECTEDCOUNT = (LVM_FIRST + 50) LVCountSelected = SendMessage(lhwndListview, LVM_GETSELECTEDCOUNT, 0, ByVal 0&) End Function
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder