Xceed FTP Library Documentation
Example topics / Using fast notification in VB
In This Topic
    Using fast notification in VB
    In This Topic

    Here is sample code demonstrating how to use custom interface advising via the Implements Visual Basic keyword. Keep in mind that custom interface advising only works for ActiveX EXE or DLL projects. It doesn't work with regular EXE projects.

    Visual Basic Copy Code

    Option Explicit
    Implements IXceedFtpEvents

    Dim m_xFtp As XceedFtp
    Dim m_lAdviseCookie As Long

    Private Sub Class_Initialize()
       ' Create instance of XceedFtp
       Set m_xFtp = New XceedFtp

       ' Advise to receive events through our implementation of IXceedFtpEvents
       Dim xAdvise As IXceedFtpAdviseEvents
       Set xAdvise = m_xFtp

       Call xAdvise.Advise(Me, m_lAdviseCookie)
       Set xAdvise = Nothing
    End Sub

    Private Sub Class_Terminate()
       ' Unadvise for events
       Dim xAdvise As IXceedFtpAdviseEvents
       Set xAdvise = m_xFtp

       Call xAdvise.Unadvise(m_lAdviseCookie)
       Set xAdvise = Nothing

       ' Free instance of XceedFtp
       Set m_xFtp = Nothing
    End Sub

    Private Sub IXceedFtpEvents_FileTransferStatus( _
       ByVal sLocalFilename As String, ByVal sRemoteFilename As String, _
       ByVal lFileSize As Long, ByVal lBytesTransferred As Long, ByVal
       nBytesPercent As Integer, _
       ByVal lTotalSize As Long, ByVal lTotalBytesTransferred As Long, ByVal
       nTotalBytesPercent As Integer, _
       ByVal lTotalFiles As Long, ByVal lTotalFilesTransferred As Long, ByVal
       nTotalFilesPercent As Integer, _
       ByVal lBytesPerSecond As Long, ByVal lTotalBytesPerSecond As Long)

       Call DisplayTransferRate(lBytesPerSecond)
    End Sub