• Welcome to PlanetSquires Forums.
 

ListView

Started by SeaVipe, August 27, 2022, 03:02:37 PM

Previous topic - Next topic

SeaVipe

Hi Paul,
I've had an Error Code 6 in my code that was hard to track down.

Some time ago you posted this to enable the top row of a ListView to be highlighted:


Function ListView_SetTopIndex( byval hLV as hwnd, byval index As Long ) As Long
    Dim rc AS RECT
   
    SendMessage( hLV, LVM_GETITEMRECT, 0, cast(LPARAM, @rc) )

    Dim As Long gle = GetLastError()
    If gle > 0 Then ? gle ' gle = 0  

    SendMessage( hLV, LVM_SCROLL, 0, (index - GetScrollPos(hLV, SB_VERT)) * (rc.Bottom - rc.Top))
   
    gle = GetLastError()
    If gle > 0 Then ? gle ' Prints 6.
    Print GetLastError() ' Clears error code.
   
Function = 0
End Function

This identical Function used in another app, and called exactly the same way, does not throw an error.
Odd that only one of several projects with the same code and calling method, returns an error.
Clive Richey