CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2001
    Location
    Sacramento CA
    Posts
    1

    Scrollbars and Keypress

    How do I tie scrollbars with keypress events? I'm working on this project that recieves instructions via the serial port (using MSCommControl) and tied the values that control the robot to scrollbars, now my problem is tying the scrollbars to keypress events. i.e. press the page up key and the gripper closes, page down and it opens. I've tried several times in the span of a week and a half, I'm already spent, I've seen someone do it but the programmer won't respond to my e-mails. Please help and restore my sanity. . .


  2. #2
    Join Date
    Aug 2001
    Location
    PA
    Posts
    150

    Re: Scrollbars and Keypress

    1- You need this API function put in a module

    Private Declare Function SendMessageByVal Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long


    Private Const WM_VSCROLL = &H115

    2- also this method

    Sub GridScroll(tb As MSFlexGrid, ByVal HorizScroll As Long, ByVal VertScroll As Long)
    SendMessageByVal tb.hwnd, WM_VSCROLL, HorizScroll, VertScroll
    End Sub

    3- In key press if you want to scroll

    A- up GridScroll Grid2, 0, 0 'up
    B- down GridScroll Grid2, 1, 0 'down



    Here I am using a grid control, in your case subtitute for the grid with whatever control you have.

    Good Luck!




    Thanks
    Hisham
    Thank You, Hisham

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

Featured