Ne znam kako, ali meni javlja par gresaka, ove nikako da skontam.
Code:
Public Function DownloadFile(URL As String) As String
On Error GoTo Err
Dim hInternetSession As Long
Dim hUrlFile As Long
Dim sReadBuffer As String * 4096 ' 4k odjednom
Dim sBuffer As String
Dim lNumberOfBytesRead As Long
Dim bDoLoop As Boolean
hInternetSession = InternetOpen("FileDownload", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
If hInternetSession = 0 Then GoTo Err
hUrlFile = InternetOpenUrl(hInternetSession, URL, vbNullString, 0, INTERNET_FLAG_RELOAD, 0)
If hUrlFile = 0 Then GoTo Err
bDoLoop = True
While bDoLoop
sReadBuffer = ""
bDoLoop = InternetReadFile(hUrlFile, sReadBuffer, _
Len(sReadBuffer), lNumberOfBytesRead)
sBuffer = sBuffer & [blue]Left$[/blue] (sReadBuffer, lNumberOfBytesRead)
If Not CBool(lNumberOfBytesRead) Then bDoLoop = False
Wend
InternetCloseHandle (hUrlFile)
InternetCloseHandle (hInternetSession)
If sBuffer = "" Then GoTo Err
DownloadFile = sBuffer
Exit Function
Err:
DownloadFile = ""
End Function
Sub ParseURLs(HTML As String)
If HTML = "" Then Exit Sub
Dim st As Long, en As Long
st = InStr(1, HTML, "href=" & Chr(34))
While st
st = st + 6
en = InStr(st, HTML, Chr(34))
If en = 0 Then Exit Sub
fs.WriteLine Mid(HTML, st, en - st)
st = [blue]InStr(en, HTML, "href=" & Chr(34))[/blue]
Wend
End Sub
1.'Public Property Left() As Integer' has no parameters and its return type cannot be indexed.
2. Type character '$' does not match declared data type 'Integer'.
3.Overload resolution failed because no accessible 'InStr' can be called without a narrowing conversion:
'Public Function InStr(Start As Integer, String1 As String, String2 As String, [Compare As Microsoft.VisualBasic.CompareMethod = Microsoft.VisualBasic.CompareMethod.Binary]) As Integer': Argument matching parameter 'Start' narrows from 'Long' to 'Integer'.
'Public Function InStr(String1 As String, String2 As String, [Compare As Microsoft.VisualBasic.CompareMethod = Microsoft.VisualBasic.CompareMethod.Binary]) As Integer': Argument matching parameter 'String1' narrows from 'Long' to 'String'.
'Public Function InStr(String1 As String, String2 As String, [Compare As Microsoft.VisualBasic.CompareMethod = Microsoft.VisualBasic.CompareMethod.Binary]) As Integer': Argument matching parameter 'Compare' narrows from 'String' to 'Microsoft.VisualBasic.CompareMethod'.
[Ovu poruku je menjao Aleksandar Ružičić dana 28.06.2008. u 12:12 GMT+1]