[HELP] Move scrollbar automatically?

Discussion in 'Programming General' started by dgameman1, Sep 11, 2011.

[HELP] Move scrollbar automatically?
  1. Unread #1 - Sep 11, 2011 at 6:47 PM
  2. dgameman1
    Joined:
    May 25, 2006
    Posts:
    122
    Referrals:
    0
    Sythe Gold:
    0

    dgameman1 Active Member
    Banned

    [HELP] Move scrollbar automatically?

    How would I go about moving the scrollbar down a littlebit once the webbrowser has completed loading?
     
  3. Unread #2 - Sep 12, 2011 at 2:55 AM
  4. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    [HELP] Move scrollbar automatically?

    Add this to a module:
    Code:
    Imports System.Runtime.InteropServices
    
    <DllImport("User32.dll")> _
        Private Sub mouse_event(ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, _
                                ByVal dwExtraInfo As Integer)
        End Sub
    
    Private Const MOUSEEVENTF_WHEEL As Int32 = &H800
    Private Const WHEEL_DELTA As Int32 = 120 
    
    Public Sub MouseScroll(Optional ByVal intDirection As Integer = 0)
            If intDirection = 1 Then
                mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -WHEEL_DELTA, 0)
            Else
                mouse_event(MOUSEEVENTF_WHEEL, 0, 0, WHEEL_DELTA, 0)
            End If
        End Sub
    To scroll up use:
    Code:
    MouseScroll(0)
    To scroll down use:
    Code:
    MouseScroll(1)
    To do this when the webbrowser has finished loading you need to use the Webbrowser's 'DocumentCompleted' or 'Navigated' event. (I forget which one it is):
    Code:
    Private Sub webBrowser_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles webBrowser.Navigated
    
        End Sub
    
    Private Sub webBrowser_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles webBrowser.DocumentCompleted
    
        End Sub
     
  5. Unread #3 - Sep 12, 2011 at 10:34 AM
  6. dgameman1
    Joined:
    May 25, 2006
    Posts:
    122
    Referrals:
    0
    Sythe Gold:
    0

    dgameman1 Active Member
    Banned

    [HELP] Move scrollbar automatically?

    You know what Covey?
    You're a fucking god. Thank you =P
     
< Question for high school! | Flash game isn't working in WebBrowser >

Users viewing this thread
1 guest


 
 
Adblock breaks this site