#Region SaveCab
Sub SaveCab(URL,InstallAfterDownload)
Install=InstallAfterDownload
If Prefs.AskForSaveLocation=True Then
If SaveDialog.Show<>cCancel Then
FilePath=SaveDialog.File
Else
Return
End If
Else
If DirExist(AppPath & "\temp")=False Then DirCreate(AppPath & "\temp")
FilePath=AppPath & "\temp\application.cab"
End If
WaitCursor(True)
If Checkconnection(URL)=False Then
NoConnection(True,False)
WaitCursor(False)
Return
End If
Response.New1
Request.New1(URL)
Request.UserAgent="Gecko/Beta (http://getgecko.org)"
Request.GetAsyncResponse
End Sub
Sub Request_Response
If Request.ResponseCode=200 Then
Response.Value=Request.AsyncResponse 'Launch the request and get the response.
Response.GetAsyncStream(Filepath) 'Get the stream
Else
WaitCursor(False)
NoConnection(True,False)
End If
End Sub
Sub Response_Stream
WaitCursor(False)
Retry:
If Install=True Then
ShellAndWait("wceload.exe", Chr(34) & Filepath & Chr(34))
If Msgbox("Did the application install successfully?","Installation",cMsgboxYesNo,cMsgboxQuestion)=cNo Then Goto Retry
End If
FrmLoading.Close
End Sub
#End Region