mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / OnBeforeDownload Event

Download identifier, a unique integer number of the downloaded resource.

The resulting (possibly redirected) URL of the resource being downloaded.

The original URL of the resource being downloaded.

The MIME type of the resource being downloaded.

The path of the local file to save the resource being downloaded. You should set this argument to a path with write permissions.

The suggested local file name of the resource being downloaded. You should set this argument to the desired name.

The total size in bytes of the resource being downloaded.

The bytes received so far for the resource being downloaded.

The progress percentage so far for the resource being downloaded.

A long indicating the MB / sec for the resource being downloaded.

By setting this argument to True you can cancel the download of the resource.

In This Topic
    OnBeforeDownload Event
    In This Topic
    Description

    Fired before a resource download starts. Resource download is initiated by Download method.

    Syntax
    Visual Basic
    Public Event OnBeforeDownload( _
       ByVal Id As Long, _
       ByVal url As String, _
       ByVal OriginalUrl As String, _
       ByVal MimeType As String, _
       ByRef FullPath As String, _
       ByRef SuggestedFileName As String, _
       ByVal TotalBytes As Long, _
       ByVal ReceivedBytes As Long, _
       ByVal PercentComplete As Long, _
       ByVal CurrentSpeed As Long, _
       ByRef Cancel As Boolean _
    )
    Parameters
    Id

    Download identifier, a unique integer number of the downloaded resource.

    url

    The resulting (possibly redirected) URL of the resource being downloaded.

    OriginalUrl

    The original URL of the resource being downloaded.

    MimeType

    The MIME type of the resource being downloaded.

    FullPath

    The path of the local file to save the resource being downloaded. You should set this argument to a path with write permissions.

    SuggestedFileName

    The suggested local file name of the resource being downloaded. You should set this argument to the desired name.

    TotalBytes

    The total size in bytes of the resource being downloaded.

    ReceivedBytes

    The bytes received so far for the resource being downloaded.

    PercentComplete

    The progress percentage so far for the resource being downloaded.

    CurrentSpeed

    A long indicating the MB / sec for the resource being downloaded.

    Cancel

    By setting this argument to True you can cancel the download of the resource.

    Remarks

    Purpose of this event is to provide a chance to Cancel the download and set the local path and filename of the downloaded resource.

    When you receive this event the download might have already progressed.

    Resource download is initiated by Download method.

    Example
    Private Sub mnuDownload_Click()
        On Error Resume Next
        Dim s As String
        s = InputBox("Download File URL:", , "https://www.webkitx.com/WebKitX_CEF3_ActiveX_x86_v2.0.0.6926.exe")
        If s = "" Then Exit Sub
        WebKitX1.Download s
        If Err.Number Then
            MsgBox Err.Description, vbCritical
        End If
    End Sub
    private void menuItemDownloadURL_Click(object sender, EventArgs e)
    {
        string input = Microsoft.VisualBasic.Interaction.InputBox("Download File URL:", "HTML5 Pad", "https://www.webkitx.com/WebKitX_CEF3_ActiveX_1.5.11.3454.exe", 500, 300);
        if (input != "")
        {
            WebKitXCEF31.Download(input);
        }
    }
    See Also