VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Two methods for retrieving the ListItem object that the mouse is over in a ListView control.

Jon B. Mooty  (4 Submissions)   Windows API Call/Explanation   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

This code gives you two methods (one using built-in functions of the ListView control, and one using SendMessage and the LVM_GETITEMRECT constant) to retrieve the ListItem object that the mouse pointer is currently over with. This is demonstrated by highlighting the item.

Inputs
To test the SendMessage method set the constant USE_SENDMESSAGE to True.

Returns
The current ListItem object the mouse pointer is over.

API Declarations
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
Private Const LVM_GETITEMRECT = &H100E
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Rate Two methods for retrieving the ListItem object that the mouse is over in a ListView control. (4(4 Vote))
Two methods for retrieving the ListItem object that the mouse is over in a ListView control..bas

Two methods for retrieving the ListItem object that the mouse is over in a ListView control. Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters