ISDBApplicationEvents::OnDownloadFinished: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
mNo edit summary
m (introduced)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{MethodDeclaration|SDBApplication|ISDBApplicationEvents|Sub OnDownloadFinished(URL As String, Success as Boolean)}}
{{MethodDeclaration|SDBApplication|ISDBApplicationEvents|Sub OnDownloadFinished(URL as String, Success as Boolean, ResponseCode as Long)}}


===Parameters===
===Parameters===
Line 5: Line 5:
{{MethodParameters  
{{MethodParameters  
  |URL |String | URL of file that has been just downloaded
  |URL |String | URL of file that has been just downloaded
  |Success |Boolean | Download was successful (true), Download has failed (false)}}
  |Success |Boolean | Download was successful (true), Download has failed (false)
|ResponseCode |Long | Returns -1 if user has cancelled the download otherwise returns HTTP status code (200 if OK, see http://www.iana.org/assignments/http-status-codes for complete list)  }}


===Event description===
===Event description===
Line 11: Line 12:
Is called whenever a file download finishes.
Is called whenever a file download finishes.


Note: This event takes effect from MediaMonkey 4.0 and higher!
{{Introduced|4.0}}


===Example code===                     
===Example code===                     
Line 20: Line 21:
End Sub
End Sub


Sub SDBDownloadFinished( URL, Success)
Sub SDBDownloadFinished( URL, Success, ResponseCode)
     If Success then
     if Success then
       MsgBox("Download has finished successfuly for the URL:"&URL)
       MsgBox("Download has finished successfuly for the URL:"&URL)
     Else
     else
       MsgBox("Download has failed for the URL:"&URL)
       MsgBox("Download has failed for the URL:"&URL&", ResponseCode = "&ResponseCode)
     End If  
     end if  
End Sub
End Sub



Latest revision as of 21:40, 20 April 2013

CoClass SDBApplication, Interface ISDBApplicationEvents

Sub OnDownloadFinished(URL as String, Success as Boolean, ResponseCode as Long)


Parameters

Name Type Description
URL String URL of file that has been just downloaded
Success Boolean Download was successful (true), Download has failed (false)
ResponseCode Long Returns -1 if user has cancelled the download otherwise returns HTTP status code (200 if OK, see http://www.iana.org/assignments/http-status-codes for complete list)


Event description

Is called whenever a file download finishes.

Introduced in MediaMonkey version 4.0.


Example code

Sub OnStartUp()    
    Script.RegisterEvent SDB, "OnDownloadFinished", "SDBDownloadFinished"
End Sub

Sub SDBDownloadFinished( URL, Success, ResponseCode)
    if Success then
      MsgBox("Download has finished successfuly for the URL:"&URL)
    else
      MsgBox("Download has failed for the URL:"&URL&", ResponseCode = "&ResponseCode)
    end if  
End Sub