PELO PROGRAMA DO VB FUNCIONA PELO EXE NAO!

SOUZA 12/07/2014 18:08:30
#439492
Pessoal peguei daqui um exemplo de download de arquivo por ftp. Quando eu executo ele pelo desenvolvedor do vb ele baixa tudo bonitinho quando compilo e executo novamente ele nao faz o download!

Codigo:

Option Explicit
[ô]Public Function DownloadFile(strURL As String, strDestination As String) As Boolean
Public Sub DownloadFile(strURL As String, strDestination As String) [ô]As Boolean
Const CHUNK_SIZE As Long = 1024
Dim intFile As Integer
Dim lngBytesReceived As Long
Dim lngFileLength As Long
Dim strHeader As String
Dim b() As Byte
Dim i As Integer

DoEvents

With Inet1

.URL = strURL
.Execute , [Ô]GET[Ô], , [Ô]Range: bytes=[Ô] & CStr(lngBytesReceived) & [Ô]-[Ô] & vbCrLf

While .StillExecuting
DoEvents
Wend

strHeader = .GetHeader
End With


strHeader = Inet1.GetHeader([Ô]Content-Length[Ô])
lngFileLength = Val(strHeader)

DoEvents

lngBytesReceived = 0

intFile = FreeFile()

Open strDestination For Binary Access Write As #intFile

Do
b = Inet1.GetChunk(CHUNK_SIZE, icByteArray)
Put #intFile, , b
lngBytesReceived = lngBytesReceived + UBound(b, 1) + 1

DownloadProgress (Round((lngBytesReceived / lngFileLength) * 100))
DoEvents
Loop While UBound(b, 1) > 0

Close #intFile

End Sub
Sub DownloadProgress(intPercent As String)
ProgressBar1.Value = intPercent [ô] Update file download progress
End Sub

Private Sub cmdDownload_Click()
Screen.MousePointer = vbHourglass

ProgressBar1.Value = 0

ProgressBar1.Visible = True [ô]show progressbar

[ô]This downloads the file and saves to your machine
Label1 = [Ô]Atualizando![Ô]

DownloadFile [Ô]http://www.provedor.com.br/Noticias/N1.jpg[Ô], [Ô]c:\N1.jpg[Ô]

Screen.MousePointer = vbDefault
MsgBox [Ô]Download Complete[Ô]

ProgressBar1.Visible = False

End Sub

Private Sub Form_Load()

Me.Caption = [Ô]Sample Downloader With Progress Bar[Ô]

ProgressBar1.Visible = False

End Sub


SOUZA 12/07/2014 18:25:48
#439493
Pessoal era so incompatibilidade com win 7 resolvido!
Tópico encerrado , respostas não são mais permitidas