H
Henry
I'm trying to get the index of the top row in the display area of a
listview (vb.net) by doing an api call to ListView_GetTopIndex. See code
below. The call is returning a 0. The SDK doc states that
ListView_GetTopIndex "Retrieves the index of the topmost visible item
when in list or report view." The listview that I'm using is in details
view. There is no "report view" in VB.Net for listview. It apears to me
that ListView_GetTopIndex will not work with a listview in details view.
Any ideas/alternatives/help appreciated.
Dim lstvScriptsFirstVisibleRow As Int32
lstvScriptsFirstVisibleRow =
Me.ListView_GetFirstVisibleRow(lstvScripts.Handle)
Private Const LVM_FIRST = &H1000
Private Const LVM_GETCOUNTPERPAGE As Long = (LVM_FIRST + 40)
Private Const LVM_GETTOPINDEX = (LVM_FIRST + 39)
Private Declare Function SendMessage Lib "user32" Alias
"SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Int32, ByVal wParam
As Int32, ByVal lParam As Int32) As Long
Private Function ListView_GetFirstVisibleRow(ByVal hwndlv As IntPtr) As
Long
ListView_GetFirstVisibleRow = SendMessage(hwndlv,
LVM_GETTOPINDEX, 0, 0)
End Function
listview (vb.net) by doing an api call to ListView_GetTopIndex. See code
below. The call is returning a 0. The SDK doc states that
ListView_GetTopIndex "Retrieves the index of the topmost visible item
when in list or report view." The listview that I'm using is in details
view. There is no "report view" in VB.Net for listview. It apears to me
that ListView_GetTopIndex will not work with a listview in details view.
Any ideas/alternatives/help appreciated.
Dim lstvScriptsFirstVisibleRow As Int32
lstvScriptsFirstVisibleRow =
Me.ListView_GetFirstVisibleRow(lstvScripts.Handle)
Private Const LVM_FIRST = &H1000
Private Const LVM_GETCOUNTPERPAGE As Long = (LVM_FIRST + 40)
Private Const LVM_GETTOPINDEX = (LVM_FIRST + 39)
Private Declare Function SendMessage Lib "user32" Alias
"SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Int32, ByVal wParam
As Int32, ByVal lParam As Int32) As Long
Private Function ListView_GetFirstVisibleRow(ByVal hwndlv As IntPtr) As
Long
ListView_GetFirstVisibleRow = SendMessage(hwndlv,
LVM_GETTOPINDEX, 0, 0)
End Function