Results 1 to 5 of 5

Thread: Scrolling

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Scrolling

    Is there a way to cause a listview to scroll through API?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2
    jim mcnamara
    Guest
    The easiest way is to use SendMessage. Use the hWnd property of the listview.

    Code:
    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Public Const SB_BOTH = 3
    Public Const SB_BOTTOM = 7
    Public Const SB_CONST_ALPHA = &H00000001
    Public Const SB_CTL = 2
    Public Const SB_ENDSCROLL = 8
    Public Const SB_GRAD_RECT = &H00000010
    Public Const SB_GRAD_TRI = &H00000020
    Public Const SB_HORZ = 0
    Public Const SB_ISSIMPLE = (WM_USER+14)
    Public Const SB_LEFT = 6
    Public Const SB_LINEDOWN = 1
    Public Const SB_LINELEFT = 0
    Public Const SB_LINERIGHT = 1
    Public Const SB_LINEUP = 0
    Public Const SB_NONE = &H00000000
    Public Const SB_PAGEDOWN = 3
    Public Const SB_PAGELEFT = 2
    Public Const SB_THUMBPOSITION = 4
    Public Const SB_THUMBTRACK = 5
    Public Const WM_VSCROLL = &H2E
    Dim wparam as long
    wparam = SB_LINEDOWN
    ' scroll odwn one line
    Call SendMessage Listview1.hWnd,WM_VSCROLL,SB_LINEDOWN, 
    _lparam, 0&
    ' scroll down one page
    wparam = SB_PAGEDOWN
    Call SendMessage Listview1.hWnd,WM_VSCROLL,SB_LINEDOWN, 
    _lparam, 0&

  3. #3

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I can't figure out how to get this to work.
    Last edited by The Hobo; Jan 5th, 2002 at 08:04 PM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4
    Megatron
    Guest
    Make the following changes. I havent tested it, though, but I think it should fix the problem.

    • Declare everything private, and put it in a Form.
    • Erase the second SendMessage declaration.
    • Remove "Call" from the line where SendMessage is called.
    • Put from "Dim wparam as long" and onwards into a command button.
    • Remove SB_LINEDOWN from the line where sendmessage is called, and replace it with wParam.
    • Pick a function to use (either scrolling up or down). Keep those lines in your command button's procedure, and erase the rest

  5. #5

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    It was a little more complicated to fix than that, but I have it now. Thanks.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width