-
May 22nd, 2015, 04:14 AM
#1
Thread Starter
Junior Member
[RESOLVED] download file from google disk with inet or ?
After much searching the Internet and found www.vbforums.com did not answer my question. The search engine of www.vbforums.com I signed "download file from Google Drive" after seven pages I stopped reading.
This code works great and I use it if I want to download the file from the website
Code:
Option Explicit
Private Sub cmdDownload_Click()
Screen.MousePointer = vbHourglass
ProgressBar1.Value = 0
ProgressBar1.Visible = True 'show progressbar
'This downloads the file and saves to your machine
DownloadFile "http://www.somesite.com/somefile.exe", App.Path & "\somefile.exe"
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
Sub DownloadProgress(intPercent As String)
ProgressBar1.Value = intPercent ' Update file download progress
End Sub
'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
But if you want to download from the Google Drive you can not with him.
link for share its:
https://drive.google.com/file/d/0B9i...ew?usp=sharing
If someone has time to be a very simple example, I am a beginner in VB6, I was grateful to him for help. Thank you for me and others who know so little like me
Last edited by hans.grgenstein; May 22nd, 2015 at 04:49 AM.
Reason: amendment
-
May 22nd, 2015, 05:08 AM
#2
Re: download file from google disk with inet or ?
Google Drive does currently offer a client REST API.
You might successfully implement this on top of the creaky old "Inet control" (Internet Transfer Control) but you will probably have far better luck using any of the modern alternatives, several of which ship as part of Windows now.
But first look at Authorizing Your App with Google Drive for things you must do even before you get access to the API.
-
May 22nd, 2015, 06:19 AM
#3
Thread Starter
Junior Member
Re: download file from google disk with inet or ?
Originally Posted by dilettante
Google Drive does currently offer a client REST API.
...
oK,
We will not bother with iNet , whether opportunities the possibility that vb6 download the file from Google Drive
Last edited by hans.grgenstein; May 22nd, 2015 at 08:42 AM.
Reason: correction
-
May 27th, 2015, 07:59 AM
#4
Thread Starter
Junior Member
Re: download file from google disk with inet or ?
it seems that it is not possible to do this or not that simple . The only thing left is to buy hosting the site and put the file there .
I'll put this as resolved because I have not found anywhere on the internet and also I 'm not educated enough to know to find a solution
-
May 27th, 2015, 02:27 PM
#5
Addicted Member
Re: [RESOLVED] download file from google disk with inet or ?
-
Oct 8th, 2015, 04:35 AM
#6
Thread Starter
Junior Member
Re: [RESOLVED] download file from google disk with inet or ?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|